Standard library header <utility>
From cppreference.net
このヘッダは 汎用ユーティリティ ライブラリの一部です。
Includes |
||
|
(C++20)
|
三方比較演算子 サポート | |
|
(C++11)
|
std::initializer_list クラステンプレート | |
名前空間 |
||
rel_ops
|
自動比較演算子を提供 | |
|
名前空間
std::rel_ops
で定義
|
||
|
(C++20で非推奨)
|
ユーザー定義の
operator
==
および
operator
<
に基づいて比較演算子を自動生成する
(関数テンプレート) |
|
関数 |
||
|
二つのオブジェクトの値を交換する
(関数テンプレート) |
||
|
(C++14)
|
引数を新しい値で置き換え、その前の値を返す
(関数テンプレート) |
|
|
(C++11)
|
関数の引数を転送し、テンプレート引数の型を使用してその値カテゴリを保持する
(関数テンプレート) |
|
|
(C++23)
|
指定された型テンプレート引数の式の値カテゴリとconst性にキャストするかのように関数引数を転送する
(関数テンプレート) |
|
|
(C++11)
|
引数をxvalueに変換する
(関数テンプレート) |
|
|
(C++11)
|
ムーブコンストラクタが例外を投げない場合、引数をxvalueに変換する
(関数テンプレート) |
|
|
(C++17)
|
引数への
const
参照を取得する
(関数テンプレート) |
|
|
(C++11)
|
評価されない文脈で使用するためのテンプレート型引数のオブジェクトへの参照を取得する
(関数テンプレート) |
|
|
(C++23)
|
列挙型をその基底型に変換する
(関数テンプレート) |
|
|
2つの整数値を比較し、符号付き負数が符号なし数より小さいことを保証する
(関数テンプレート) |
||
|
(C++20)
|
整数値が指定された整数型の範囲内にあるかどうかをチェックする
(関数テンプレート) |
|
|
(C++23)
|
実行不可能なポイントをマークする
(関数) |
|
引数の型によって決定される型の
pair
オブジェクトを作成する
(関数テンプレート) |
||
|
(C++20で削除)
(C++20で削除)
(C++20で削除)
(C++20で削除)
(C++20で削除)
(C++20)
|
pair
内の値を辞書式順序で比較する
(関数テンプレート) |
|
|
(C++11)
|
std::swap
アルゴリズムを特殊化する
(関数テンプレート) |
|
|
(C++11)
|
pair
の要素にアクセスする
(関数テンプレート) |
|
クラス |
||
|
二値タプル、すなわち値のペアを実装する
(クラステンプレート) |
||
|
(C++11)
|
タプルライク型の要素数を取得する
(クラステンプレート) |
|
|
(C++11)
|
tuple-like型の要素型を取得する
(クラステンプレート) |
|
|
(C++11)
|
pair
のサイズを取得する
(クラステンプレートの特殊化) |
|
|
(C++11)
|
pair
の要素の型を取得する
(クラステンプレートの特殊化) |
|
|
(C++14)
|
整数のコンパイル時シーケンスを実装する
(クラステンプレート) |
|
前方宣言 |
||
|
ヘッダーで定義
<tuple>
|
||
|
(C++11)
|
異なる型の要素を保持する固定サイズのコンテナを実装する
(クラステンプレート) |
|
|
ヘッダーで定義
<variant>
|
||
|
(C++17)
|
デフォルト構築不可能な型の
variant
で最初の代替型として使用するためのプレースホルダ型
(クラス) |
|
定数 |
||
|
(C++11)
|
tuple
の要素を
tie
で展開する際に要素をスキップするためのプレースホルダ
(定数) |
|
タグ |
||
|
ピースワイズ構築タグ
(タグ) |
||
|
インプレース構築タグ
(タグ) |
||
|
(C++26)
|
値構築タグ
(タグ) |
|
概要
#include <compare> #include <initializer_list> namespace std { // swap template<class T> constexpr void swap(T& a, T& b) noexcept(/* 説明を参照 */); template<class T, size_t N> constexpr void swap(T (&a)[N], T (&b)[N] (注:元のテキストは閉じ括弧のみのため、日本語でも同じ記号を保持します)) noexcept(is_nothrow_swappable_v<T>); // 交換 template<class T, class U = T> constexpr T exchange(T& obj, U&& new_val); // forward/move template<class T> constexpr T&& forward(remove_reference_t<T>& t) noexcept; template<class T> constexpr T&& forward(remove_reference_t<T>&& t) noexcept; template<class T, class U> constexpr /* 説明を参照 */ forward_like(U&& x) noexcept; template<class T> constexpr remove_reference_t<T>&& move(T&&) noexcept; template<class T> constexpr conditional_t< !is_nothrow_move_constructible_v<T> && is_copy_constructible_v<T>, const T&, T&&> move_if_noexcept(T& x) noexcept; // as_const template<class T> constexpr add_const_t<T>& as_const(T& t) noexcept; template<class T> void as_const(const T&&) = delete; // declval template<class T> add_rvalue_reference_t<T> declval() noexcept; // 未評価オペランドとして // 整数比較関数 template<class T, class U> constexpr bool cmp_equal(T t, U u) noexcept; template<class T, class U> constexpr bool cmp_not_equal(T t, U u) noexcept; template<class T, class U> constexpr bool cmp_less(T t, U u) noexcept; template<class T, class U> constexpr bool cmp_greater(T t, U u) noexcept; template<class T, class U> constexpr bool cmp_less_equal(T t, U u) noexcept; template<class T, class U> constexpr bool cmp_greater_equal(T t, U u) noexcept; template<class R, class T> constexpr bool in_range(T t) noexcept; // to_underlying template<class T> constexpr underlying_type_t<T> to_underlying(T value) noexcept; // 到達不能 [[noreturn]] void unreachable(); // コンパイル時整数シーケンス template<class T, T...> struct integer_sequence; template<size_t... I> using index_sequence = integer_sequence<size_t, I...>; template<class T, T N> using make_integer_sequence = integer_sequence<T, /* 説明を参照 */>; template<size_t N> using make_index_sequence = make_integer_sequence<size_t, N>; template<class... T> using index_sequence_for = make_index_sequence<sizeof...(T)>; // クラステンプレート pair template<class T1, class T2> struct pair; // pair 特殊化アルゴリズム template<class T1, class T2> constexpr bool operator==(const pair<T1, T2>&, const pair<T1, T2>&); template<class T1, class T2> constexpr common_comparison_category_t</*synth-three-way-result*/<T1>, /*synth-three-way-result*/<T2>> operator<=>(const pair<T1, T2>&, const pair<T1, T2>&); template<class T1, class T2> constexpr void swap(pair<T1, T2>& x, pair<T1, T2>& y) noexcept(noexcept(x.swap(y))); template<class T1, class T2> constexpr /* 説明を参照 */ make_pair(T1&&, T2&&); // pairに対するtuple-likeアクセス template<class T> struct tuple_size; template<size_t I, class T> struct tuple_element; template<class T1, class T2> struct tuple_size<pair<T1, T2>>; template<size_t I, class T1, class T2> struct tuple_element<I, pair<T1, T2>>; template<size_t I, class T1, class T2> constexpr tuple_element_t<I, pair<T1, T2>>& get(pair<T1, T2>&) noexcept; template<size_t I, class T1, class T2> constexpr tuple_element_t<I, pair<T1, T2>>&& get(pair<T1, T2>&&) noexcept; template<size_t I, class T1, class T2> constexpr const tuple_element_t<I, pair<T1, T2>>& get(const pair<T1, T2>&) noexcept; template<size_t I, class T1, class T2> constexpr const tuple_element_t<I, pair<T1, T2>>&& get(const pair<T1, T2>&&) noexcept; template<class T1, class T2> constexpr T1& get(pair<T1, T2>& p) noexcept; template<class T1, class T2> constexpr const T1& get(const pair<T1, T2>& p) noexcept; template<class T1, class T2> constexpr T1&& get(pair<T1, T2>&& p) noexcept; template<class T1, class T2> constexpr const T1&& get(const pair<T1, T2>&& p) noexcept; template<class T2, class T1> constexpr T2& get(pair<T1, T2>& p) noexcept; template<class T2, class T1> constexpr const T2& get(const pair<T1, T2>& p) noexcept; template<class T2, class T1> constexpr T2&& get(pair<T1, T2>&& p) noexcept; template<class T2, class T1> constexpr const T2&& get(const pair<T1, T2>&& p) noexcept; // pair の区分構築 struct piecewise_construct_t { explicit piecewise_construct_t() = default; }; inline constexpr piecewise_construct_t piecewise_construct{}; template<class... Types> class tuple; // <tuple> で定義 // インプレース構築 struct in_place_t { explicit in_place_t() = default; }; inline constexpr in_place_t in_place{}; template<class T> struct in_place_type_t { explicit in_place_type_t() = default; }; template<class T> inline constexpr in_place_type_t<T> in_place_type{}; template<size_t I> struct in_place_index_t { explicit in_place_index_t() = default; }; template<size_t I> inline constexpr in_place_index_t<I> in_place_index{}; // 非型引数タグ template<auto V> struct nontype_t { explicit nontype_t() = default; }; template<auto V> inline constexpr nontype_t<V> nontype{}; } // deprecated namespace std::rel_ops { template<class T> bool operator!=(const T&, const T&); template<class T> bool operator> (const T&, const T&); template<class T> bool operator<=(const T&, const T&); template<class T> bool operator>=(const T&, const T&); }
クラステンプレート std::integer_sequence
namespace std { template<class T, T... I> struct integer_sequence { using value_type = T; static constexpr size_t size() noexcept { return sizeof...(I); } }; }
クラステンプレート std::pair
namespace std { template<class T1, class T2> struct pair { using first_type = T1; using second_type = T2; T1 first; T2 second; pair(const pair&) = default; pair(pair&&) = default; constexpr explicit(/* 説明を参照 */) pair(); constexpr explicit(/* 説明を参照 */) pair(const T1& x, const T2& y); template<class U1 = T1, class U2 = T2> constexpr explicit(/* 説明を参照 */) pair(U1&& x, U2&& y); template<class U1, class U2> constexpr explicit(/* 説明を参照 */) pair(const pair<U1, U2>& p); template<class U1, class U2> constexpr explicit(/* 説明を参照 */) pair(pair<U1, U2>&& p); template<class... Args1, class... Args2> constexpr pair(piecewise_construct_t, tuple<Args1...> first_args, tuple<Args2...> second_args); constexpr pair& operator=(const pair& p); template<class U1, class U2> constexpr pair& operator=(const pair<U1, U2>& p); constexpr pair& operator=(pair&& p) noexcept(/* 説明を参照 */); template<class U1, class U2> constexpr pair& operator=(pair<U1, U2>&& p); constexpr void swap(pair& p) noexcept(/* 説明を参照 */); }; template<class T1, class T2> pair(T1, T2) -> pair<T1, T2>; }
関連項目
|
(C++11)
|
std::tuple クラステンプレート |