std::identity
提供: cppreference.com
< cpp | utility | functional
ヘッダ <functional> で定義 | ||
struct identity; | (C++20以上) | |
std::identity
は引数を変更せずに返す operator() を持つ関数オブジェクトの型です。
目次 |
[編集]メンバ関数
メンバ型 | 定義 |
is_transparent | /* unspecified */ |
[編集]メンバ関数
operator() | 引数を変更せずに返します (パブリックメンバ関数) |
std::identity::operator()
template<class T> constexpr T&& operator()( T&& t )constnoexcept; | ||
std::forward<T>(t) を返します。
引数
t | - | 返す引数 |
戻り値
std::forward<T>(t)。
[編集]ノート
メンバ型 is_transparent
はこの関数オブジェクトが透過的な関数オブジェクトである、つまり、任意の型の引数を受理し、不均一な分脈や右辺値引数で使用されたときに不要なコピーや変換を回避する完全転送を使用することを、呼び出し元に示します。 特に、 std::set::find や std::set::lower_bound のようなテンプレート関数は Compare
型についてこのメンバ型を使用します。
[編集]例
This section is incomplete Reason: no example |