std::not_fn
ヘッダ <functional> で定義
|
||
template< class F> /*unspecified*/ not_fn( F&& f ); |
(C++17以上) (C++20未満) |
|
template< class F> constexpr /*unspecified*/ not_fn( F&& f ); |
(C++20以上) | |
保持する呼び出し可能なオブジェクトの否定を返す転送呼び出しラッパーを作成します。
目次 |
[編集] 引数
f | - | ラッパーによって保持される Callable なオブジェクトの構築元 |
型の要件 | ||
-std::decay_t<F> は Callable および MoveConstructible の要件を満たさなければなりません。
| ||
-std::is_constructible_v<std::decay_t<F>, F> が true であることが要求されます。 |
[編集] 戻り値
未規定な型 T の関数オブジェクト。 以下のメンバを持ちます。
std::not_fn の戻り値の型
メンバオブジェクト
std::not_fn
の戻り値の型は std::decay_t<F> 型のメンバオブジェクトを保持します。
コンストラクタ
(1) | ||
explicit T(F&& f); // 説明専用 |
(C++17以上) (C++20未満) |
|
explicit constexpr T(F&& f); // 説明専用 |
(C++20以上) | |
T(T&& f) = default; T(const T& f) = default; |
(2) | |
メンバ関数 operator()
(1) | ||
template<class... Args> auto operator()(Args&&... args) & -> decltype( |
(C++17以上) (C++20未満) |
|
template<class... Args> constexpr auto operator()(Args&&... args) & -> decltype( |
(C++20以上) | |
(2) | ||
template<class... Args> auto operator()(Args&&... args) && -> decltype( |
(C++17以上) (C++20未満) |
|
template<class... Args> constexpr auto operator()(Args&&... args) && -> decltype( |
(C++20以上) | |
ただし fd
は std::decay_t<F> 型のメンバオブジェクトです。
[編集] 例外
fd
の構築が例外を投げなければ、例外を投げません。
[編集] ノート
not_fn
は C++03 時代の否定子 std::not1 および std::not2 を置き換える意図があります。
[編集] Example
This section is incomplete Reason: no example |
[編集] 関連項目
(C++17で非推奨)(C++20で削除) |
カスタム std::unary_negate オブジェクトを構築します (関数テンプレート) |
(C++17で非推奨)(C++20で削除) |
カスタム std::binary_negate オブジェクトを構築します (関数テンプレート) |