std:: greater
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Old binders and adaptors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ヘッダーで定義
<functional>
|
||
|
template
<
class
T
>
struct greater ; |
(C++14まで) | |
|
template
<
class
T
=
void
>
struct greater ; |
(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()
|
第1引数が第2引数より
大きい
かどうかをチェックする
(public member function) |
std::greater:: operator()
|
bool
operator
(
)
(
const
T
&
lhs,
const
T
&
rhs
)
const
;
|
(constexpr since C++14) | |
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
を実装する制約付き関数オブジェクト
(クラス) |