std::less<void>
| ヘッダ <functional>
|
||
template<>
class less<void>;
|
で定義 (C++14以上) | |
std::less<void> は std::less の特殊化であり、その引数と戻り値の型が推定されます。
ネストされた型
| ネスト型 | 定義 |
is_transparent
|
unspecified |
メンバー関数
|
operator()
|
lhs
が
rhs
より小さいかどうかをテストする
(public member function) |
std::less<void>:: operator()
|
template
<
class
T,
class
U
>
constexpr
auto
operator
(
)
(
T
&&
lhs, U
&&
rhs
)
const
|
||
std:: forward < T > ( lhs ) < std:: forward < U > ( rhs ) の結果を返します。
パラメータ
| lhs, rhs | - | 比較する値 |
戻り値
std:: forward < T > ( lhs ) < std:: forward < U > ( rhs ) 。
ポインタを比較する組み込み演算子が呼び出された場合、結果は 実装定義のポインタに対する厳密な全順序 と一致します。
例外
実装定義の例外をスローする可能性があります。
例
#include <algorithm> #include <functional> constexpr bool strictly_negative(int lhs) { return std::less<>()(lhs, 0); } int main() { constexpr signed low = 010; constexpr unsigned high = 10; std::less<> less{}; static_assert(less(low, high)); constexpr static auto arr = {0, -1, -2, -3, -4, -5}; static_assert(!std::all_of(arr.begin(), arr.end(), strictly_negative)); static_assert(std::all_of(arr.begin() + 1, arr.end(), strictly_negative)); }
不具合報告
以下の動作変更の欠陥報告書は、以前に公開されたC++規格に対して遡及的に適用されました。
| DR | 適用対象 | 公開時の動作 | 正しい動作 |
|---|---|---|---|
| LWG 2562 | C++98 | the pointer total order might be inconsistent | guaranteed to be consistent |