std::less_equal
From cppreference.com
< cpp | utility | functional
| ヘッダ <functional> で定義 |
||
template< class T > struct less_equal; |
(C++14まで) | |
| template< class T = void > struct less_equal; |
(C++14以降) | |
比較を実行するための関数オブジェクト。テンプレートの本体は、型Tのoperator<=を呼び出します。
目次 |
[編集] 特殊化
| (C++14) |
パラメータ型と戻り値の型を推論する、x <= y を実装する関数オブジェクト (クラステンプレートの特殊化) |
[編集] メンバー型
| 型 | 定義 |
result_type (C++17で非推奨)(C++20で削除) |
bool |
first_argument_type (C++17で非推奨)(C++20で削除) |
T
|
second_argument_type (C++17で非推奨)(C++20で削除) |
T
|
|
これらのメンバー型は、std::binary_function<T, T, bool> を公開継承することによって取得されます。 |
(C++11まで) |
[編集] メンバ関数
| operator() |
最初の引数が2番目の引数より小さいか等しいかを確認します (public member function) |
std::less_equal::operator()
bool operator()( const T& lhs, const T& rhs ) const; |
(C++14以降constexpr) | |
lhs が rhs より小さいか等しいかを確認します。
パラメータ
| lhs, rhs | - | 比較する値 |
戻り値
lhs <= rhs.
T がポインタ型の場合、結果はポインタに対する実装定義の厳密な全順序と整合します。
[編集] 例外
実装定義の例外をスローする場合があります。
可能な実装
constexpr bool operator()(const T& lhs, const T& rhs) const { return lhs <= rhs; // assumes that the implementation handles pointer total order } |
[編集] 不具合報告
以下の動作変更を伴う欠陥報告が、以前に公開されたC++標準に遡って適用されました。
| DR | 適用対象 | 公開された動作 | 正しい動作 |
|---|---|---|---|
| LWG 2562 | C++98 | ポインタの全順序が不整合である可能性がある | 一貫性が保証される |
[編集] 関連項目
| x < y を実装する関数オブジェクト (クラステンプレート) | |
| (C++20) |
x <= y を実装する制約付き関数オブジェクト (クラス) |