Files
2025-10-25 03:02:53 +03:00

20 lines
3.0 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[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.8Three-way comparison operator[expr.spaceship]")[.](#1.sentence-1)
[🔗](#lib:is_eq)
// all freestandingnamespace std {// [[cmp.categories]](cmp.categories "17.12.2Comparison 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.3Class 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.4Concept three_­way_­comparable"), concept [three_way_comparable](cmp.concept#concept:three_way_comparable "17.12.4Concept 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.5Result 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.8Class compare_­three_­way"), class compare_three_waystruct compare_three_way; // [[cmp.alg]](cmp.alg "17.12.6Comparison 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.7Type 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;}