std::partial_ordering
From cppreference.com
Defined in header <compare>
|
||
class partial_ordering; |
(since C++20) | |
The class type std::partial_ordering
is the result type of a three-way comparison that:
- Admits all six relational operators (
==
,!=
,<
,<=
,>
,>=
).
- Does not imply substitutability: if a is equivalent to b, f(a) may not be equivalent to f(b), where f denotes a function that reads only comparison-salient state that is accessible via the argument's public const members. In other words, equivalent values may be distinguishable.
- Admits incomparable values: a < b, a == b, and a > b may all be false.
Contents |
[edit] Constants
The type std::partial_ordering
has four valid values, implemented as const static data members of its type:
Name | Definition |
inline constexpr std::partial_ordering less [static] |
a valid value indicating less-than (ordered before) relationship (public static member constant) |
inline constexpr std::partial_ordering equivalent [static] |
a valid value indicating equivalence (neither ordered before nor ordered after) (public static member constant) |
inline constexpr std::partial_ordering greater [static] |
a valid value indicating greater-than (ordered after) relationship (public static member constant) |
inline constexpr std::partial_ordering unordered [static] |
a valid value indicating relationship with an incomparable value (public static member constant) |
[edit] Conversions
std::partial_ordering
cannot be implicitly converted to other comparison category types, while both std::strong_ordering and std::weak_ordering are implicitly-convertible to partial_ordering
.