std::negate
提供: cppreference.com
< cpp | utility | functional
ヘッダ <functional> で定義 | ||
template<class T > struct negate; | (C++14未満) | |
template<class T =void> struct negate; | (C++14以上) | |
否定を行うための関数オブジェクト。 実質的に T
型のインスタンスに対して operator- を呼びます。
目次 |
[編集]特殊化
標準ライブラリは
| (C++14以上) |
メンバ型
| (C++20未満) |
[編集]メンバ関数
operator() | 引数の否定を返します (パブリックメンバ関数) |
std::negate::operator()
T operator()(const T& arg )const; | (C++14未満) | |
constexpr T operator()(const T& arg )const; | (C++14以上) | |
arg
の否定を返します。
引数
arg | - | 否定を計算する値 |
戻り値
-arg の結果。
例外
(なし)
実装例
constexpr T operator()(const T &arg)const{return-arg;} |