std::weak_order(3) | C++ Standard Libary | std::weak_order(3) |
NAME¶
std::weak_order - std::weak_order
Synopsis¶
Defined in header <compare>
inline namespace /* unspecified */ {
inline constexpr /* unspecified */ weak_order = /* unspecified (since
C++20)
*/;
}
Call signature
template< class T, class U >
requires /* see below */
constexpr std::weak_ordering weak_order(T&& t, U&& u)
noexcept(/* see
below */);
Compares two values using 3-way comparison and produces a result of type
std::weak_ordering.
Let t and u be expressions and T and U denote decltype((t)) and decltype((u))
respectively, std::weak_order(t, u) is expression-equivalent to:
* If std::is_same_v<std::decay_t<T>, std::decay_t<U>> is
true:
* std::weak_ordering(weak_order(t, u)), if it is a well-formed expression
with overload resolution performed in a context that does not include a
declaration of std::weak_order,
* otherwise, if T is a floating-point type:
* if std::numeric_limits<T>::is_iec559 is true, performs the weak
ordering comparison of floating-point values (see below) and returns
that result as a value of type std::weak_ordering,
* otherwise, yields a value of type std::weak_ordering that is
consistent with the ordering observed by T's comparison operators,
* otherwise, std::weak_ordering(std::compare_three_way()(t, u)), if it is
well-formed,
* otherwise, std::weak_ordering(std::strong_order(t, u)), if it is
well-formed.
* In all other cases, the expression is ill-formed, which can result in
substitution failure when it appears in the immediate context of a template
instantiation.
Example¶
This section is incomplete
Reason: no example
See also¶
weak_ordering the result type of 3-way comparison that supports
all 6
(C++20) operators and is not substitutable
(class)
strong_order performs 3-way comparison and produces a result of type
(C++20) std::strong_ordering
(customization point object)
partial_order performs 3-way comparison and produces a result of type
(C++20) std::partial_ordering
(customization point object)
compare_weak_order_fallback performs 3-way comparison and produces a result
of type
(C++20) std::weak_ordering, even if operator<=> is unavailable
(customization point object)
Category:¶
* Todo no example
2024.06.10 | http://cppreference.com |