std::negate<void>
| 헤더 <functional>
|
||
template<>
class negate<void>;
|
(C++14부터)에 정의됨 | |
std::negate<>은 std::negate의 특수화로서 매개변수와 반환 타입이 추론됩니다.
멤버 타입
| 타입 | 정의 |
is_transparent
|
unspecified |
멤버 함수
|
operator()
|
인자의 부호를 반전하여 반환합니다
(public member function) |
std::negate<void>:: operator()
|
template
<
class
T
>
constexpr
auto
operator
(
)
(
T
&&
arg
)
const
|
||
arg 의 부정(negation) 결과를 반환합니다.
매개변수
| arg | - | 부정할 값 |
반환 값
- std:: forward < T > ( arg ) .
예제
#include <complex> #include <functional> #include <iostream> int main() { auto complex_negate = std::negate<void>{}; // "void"는 생략 가능 constexpr std::complex z(4, 2); std::cout << z << '\n'; std::cout << -z << '\n'; std::cout << complex_negate(z) << '\n'; }
출력:
(4,2) (-4,-2) (-4,-2)