20 lines
3.0 KiB
Markdown
20 lines
3.0 KiB
Markdown
[compare.syn]
|
||
|
||
# 17 Language support library [[support]](./#support)
|
||
|
||
## 17.12 Comparisons [[cmp]](cmp#compare.syn)
|
||
|
||
### 17.12.1 Header <compare> synopsis [compare.syn]
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L4783)
|
||
|
||
The header <compare> specifies types, objects, and functions
|
||
for use primarily in connection with
|
||
the [three-way comparison operator](expr.spaceship "7.6.8 Three-way comparison operator [expr.spaceship]")[.](#1.sentence-1)
|
||
|
||
[ð](#lib:is_eq)
|
||
|
||
// all freestandingnamespace std {// [[cmp.categories]](cmp.categories "17.12.2 Comparison category types"), comparison category typesclass partial_ordering; class weak_ordering; class strong_ordering; // named comparison functionsconstexpr bool is_eq (partial_ordering cmp) noexcept { return cmp == 0; }constexpr bool is_neq (partial_ordering cmp) noexcept { return cmp != 0; }constexpr bool is_lt (partial_ordering cmp) noexcept { return cmp < 0; }constexpr bool is_lteq(partial_ordering cmp) noexcept { return cmp <= 0; }constexpr bool is_gt (partial_ordering cmp) noexcept { return cmp > 0; }constexpr bool is_gteq(partial_ordering cmp) noexcept { return cmp >= 0; }// [[cmp.common]](cmp.common "17.12.3 Class template common_comparison_category"), common comparison category typetemplate<class... Ts>struct common_comparison_category {using type = *see below*; }; template<class... Ts>using common_comparison_category_t = typename common_comparison_category<Ts...>::type; // [[cmp.concept]](cmp.concept "17.12.4 Concept three_way_comparable"), concept [three_way_comparable](cmp.concept#concept:three_way_comparable "17.12.4 Concept three_way_comparable [cmp.concept]")template<class T, class Cat = partial_ordering>concept three_way_comparable = *see below*; template<class T, class U, class Cat = partial_ordering>concept three_way_comparable_with = *see below*; // [[cmp.result]](cmp.result "17.12.5 Result of three-way comparison"), result of three-way comparisontemplate<class T, class U = T> struct compare_three_way_result; template<class T, class U = T>using compare_three_way_result_t = typename compare_three_way_result<T, U>::type; // [[comparisons.three.way]](comparisons.three.way "22.10.8.8 Class compare_three_way"), class compare_three_waystruct compare_three_way; // [[cmp.alg]](cmp.alg "17.12.6 Comparison algorithms"), comparison algorithmsinline namespace *unspecified* {inline constexpr *unspecified* strong_order = *unspecified*; inline constexpr *unspecified* weak_order = *unspecified*; inline constexpr *unspecified* partial_order = *unspecified*; inline constexpr *unspecified* compare_strong_order_fallback = *unspecified*; inline constexpr *unspecified* compare_weak_order_fallback = *unspecified*; inline constexpr *unspecified* compare_partial_order_fallback = *unspecified*; }// [[compare.type]](compare.type "17.12.7 Type Ordering"), type orderingtemplate<class T, class U>struct type_order; template<class T, class U>constexpr strong_ordering type_order_v = type_order<T, U>::value;}
|