std::negate<void>
| ヘッダ <functional>
|
||
template<>
class negate<void>;
|
(C++14以上) で定義される | |
std::negate<> は、std::negate の特殊化であり、引数と戻り値の型が推論されます。
メンバー型
| 型 | 定義 |
is_transparent
|
unspecified |
メンバー関数
|
operator()
|
その引数の否定を返す
(公開メンバ関数) |
std::negate<void>:: operator()
|
template
<
class
T
>
constexpr
auto
operator
(
)
(
T
&&
arg
)
const
|
||
arg の否定結果を返します。
パラメータ
| 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)