[cmp.strongord] # 17 Language support library [[support]](./#support) ## 17.12 Comparisons [[cmp]](cmp#strongord) ### 17.12.2 Comparison category types [[cmp.categories]](cmp.categories#cmp.strongord) #### 17.12.2.4 Class strong_ordering [cmp.strongord] [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L5144) The strong_ordering type is typically used as the result type of a three-way comparison operator ([[expr.spaceship]](expr.spaceship "7.6.8 Three-way comparison operator")) for a type that admits all of the six two-way comparison operators ([[expr.rel]](expr.rel "7.6.9 Relational operators"), [[expr.eq]](expr.eq "7.6.10 Equality operators")) and for which equality does imply substitutability[.](#1.sentence-1) [🔗](#lib:strong_ordering) namespace std {class strong_ordering {int *value*; // *exposition only*// exposition-only constructorsconstexpr explicit strong_ordering(*ord* v) noexcept : *value*(int(v)) {} // *exposition only*public:// valid valuesstatic const strong_ordering less; static const strong_ordering equal; static const strong_ordering equivalent; static const strong_ordering greater; // conversionsconstexpr operator partial_ordering() const noexcept; constexpr operator weak_ordering() const noexcept; // comparisonsfriend constexpr bool operator==(strong_ordering v, *unspecified*) noexcept; friend constexpr bool operator==(strong_ordering v, strong_ordering w) noexcept = default; friend constexpr bool operator< (strong_ordering v, *unspecified*) noexcept; friend constexpr bool operator> (strong_ordering v, *unspecified*) noexcept; friend constexpr bool operator<=(strong_ordering v, *unspecified*) noexcept; friend constexpr bool operator>=(strong_ordering v, *unspecified*) noexcept; friend constexpr bool operator< (*unspecified*, strong_ordering v) noexcept; friend constexpr bool operator> (*unspecified*, strong_ordering v) noexcept; friend constexpr bool operator<=(*unspecified*, strong_ordering v) noexcept; friend constexpr bool operator>=(*unspecified*, strong_ordering v) noexcept; friend constexpr strong_ordering operator<=>(strong_ordering v, *unspecified*) noexcept; friend constexpr strong_ordering operator<=>(*unspecified*, strong_ordering v) noexcept; }; // valid values' definitionsinline constexpr strong_ordering strong_ordering::less(*ord*::*less*); inline constexpr strong_ordering strong_ordering::equal(*ord*::*equal*); inline constexpr strong_ordering strong_ordering::equivalent(*ord*::*equivalent*); inline constexpr strong_ordering strong_ordering::greater(*ord*::*greater*);} [🔗](#lib:operator_partial_ordering,strong_ordering) `constexpr operator partial_ordering() const noexcept; ` [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L5204) *Returns*: *value* == 0 ? partial_ordering::equivalent :*value* < 0 ? partial_ordering::less : partial_ordering::greater [🔗](#lib:operator_weak_ordering,strong_ordering) `constexpr operator weak_ordering() const noexcept; ` [3](#3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L5219) *Returns*: *value* == 0 ? weak_ordering::equivalent :*value* < 0 ? weak_ordering::less : weak_ordering::greater [🔗](#lib:operator==,strong_ordering) `constexpr bool operator==(strong_ordering v, unspecified) noexcept; constexpr bool operator< (strong_ordering v, unspecified) noexcept; constexpr bool operator> (strong_ordering v, unspecified) noexcept; constexpr bool operator<=(strong_ordering v, unspecified) noexcept; constexpr bool operator>=(strong_ordering v, unspecified) noexcept; ` [4](#4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L5242) *Returns*: v.*value* @ 0 for operator@[.](#4.sentence-1) [🔗](#lib:operator%3c,strong_ordering_) `constexpr bool operator< (unspecified, strong_ordering v) noexcept; constexpr bool operator> (unspecified, strong_ordering v) noexcept; constexpr bool operator<=(unspecified, strong_ordering v) noexcept; constexpr bool operator>=(unspecified, strong_ordering v) noexcept; ` [5](#5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L5259) *Returns*: 0 @ v.*value* for operator@[.](#5.sentence-1) [🔗](#lib:operator%3c=%3e,strong_ordering) `constexpr strong_ordering operator<=>(strong_ordering v, unspecified) noexcept; ` [6](#6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L5270) *Returns*: v[.](#6.sentence-1) [🔗](#lib:operator%3c=%3e,strong_ordering_) `constexpr strong_ordering operator<=>(unspecified, strong_ordering v) noexcept; ` [7](#7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L5281) *Returns*: v < 0 ? strong_ordering​::​greater : v > 0 ? strong_ordering​::​less : v[.](#7.sentence-1)