Difference between revisions of "cpp/utility/compare/named comparison functions"
From cppreference.com
m (→See also) |
(added ; for consistency) |
||
Line 19: | Line 19: | ||
}} | }} | ||
{{dcl |num=6|since=c++20| | {{dcl |num=6|since=c++20| | ||
− | constexpr bool is_gteq( std::partial_ordering cmp ) noexcept | + | constexpr bool is_gteq( std::partial_ordering cmp ) noexcept; |
}} | }} | ||
{{dcl end}} | {{dcl end}} |
Latest revision as of 11:28, 1 September 2023
Defined in header <compare>
|
||
constexpr bool is_eq( std::partial_ordering cmp ) noexcept; |
(1) | (since C++20) |
constexpr bool is_neq( std::partial_ordering cmp ) noexcept; |
(2) | (since C++20) |
constexpr bool is_lt( std::partial_ordering cmp ) noexcept; |
(3) | (since C++20) |
constexpr bool is_lteq( std::partial_ordering cmp ) noexcept; |
(4) | (since C++20) |
constexpr bool is_gt( std::partial_ordering cmp ) noexcept; |
(5) | (since C++20) |
constexpr bool is_gteq( std::partial_ordering cmp ) noexcept; |
(6) | (since C++20) |
These functions take a result of 3-way comparison and convert it to the result of one of the six relational operators
Specifically, these functions return
1) cmp == 0
2) cmp != 0
3) cmp < 0
4) cmp <= 0
5) cmp > 0
6) cmp >= 0
Contents |
[edit] Parameters
cmp | - | result of 3-way comparison |
[edit] Return value
bool result of the corresponding relational operation
[edit] Example
This section is incomplete Reason: no example |
[edit] See also
(C++20) |
the result type of 3-way comparison that supports all 6 operators, is not substitutable, and allows incomparable values (class) |