This commit is contained in:
2025-10-25 03:02:53 +03:00
commit 043225d523
3416 changed files with 681196 additions and 0 deletions

187
cppdraft/range/cmp.md Normal file
View File

@@ -0,0 +1,187 @@
[range.cmp]
# 22 General utilities library [[utilities]](./#utilities)
## 22.10 Function objects [[function.objects]](function.objects#range.cmp)
### 22.10.9 Concept-constrained comparisons [range.cmp]
[🔗](#lib:equal_to)
struct ranges::equal_to {template<class T, class U>constexpr bool operator()(T&& t, U&& u) const; using is_transparent = *unspecified*;};
[🔗](#itemdecl:1)
`template<class T, class U>
constexpr bool operator()(T&& t, U&& u) const;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L12601)
*Constraints*: T and U satisfy [equality_comparable_with](concept.equalitycomparable#concept:equality_comparable_with "18.5.4Concept equality_­comparable[concept.equalitycomparable]")[.](#1.sentence-1)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L12605)
*Preconditions*: If the expression std::forward<T>(t) == std::forward<U>(u) results in a call to a built-in operator == comparing pointers of typeP, the conversion sequences from both T and U to P are equality-preserving ([[concepts.equality]](concepts.equality "18.2Equality preservation"));
otherwise, T and U model [equality_comparable_with](concept.equalitycomparable#concept:equality_comparable_with "18.5.4Concept equality_­comparable[concept.equalitycomparable]")[.](#2.sentence-1)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L12613)
*Effects*:
- [(3.1)](#3.1)
If the expression std::forward<T>(t) == std::forward<U>(u) results in
a call to a built-in operator == comparing pointers:
returns false if either (the converted value of) t precedes u or u precedes t in the implementation-defined strict
total order over pointers ([[defns.order.ptr]](defns.order.ptr "3.28implementation-defined strict total order over pointers")) and otherwise true.
- [(3.2)](#3.2)
Otherwise, equivalent to: return std::forward<T>(t) == std::forward<U>(u);
[🔗](#lib:not_equal_to)
struct ranges::not_equal_to {template<class T, class U>constexpr bool operator()(T&& t, U&& u) const; using is_transparent = *unspecified*;};
[🔗](#itemdecl:2)
`template<class T, class U>
constexpr bool operator()(T&& t, U&& u) const;
`
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L12645)
*Constraints*: T and U satisfy [equality_comparable_with](concept.equalitycomparable#concept:equality_comparable_with "18.5.4Concept equality_­comparable[concept.equalitycomparable]")[.](#4.sentence-1)
[5](#5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L12649)
*Effects*: Equivalent to:return !ranges::equal_to{}(std::forward<T>(t), std::forward<U>(u));
[🔗](#lib:greater)
struct ranges::greater {template<class T, class U>constexpr bool operator()(T&& t, U&& u) const; using is_transparent = *unspecified*;};
[🔗](#itemdecl:3)
`template<class T, class U>
constexpr bool operator()(T&& t, U&& u) const;
`
[6](#6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L12673)
*Constraints*: T and U satisfy [totally_ordered_with](concept.totallyordered#concept:totally_ordered_with "18.5.5Concept totally_­ordered[concept.totallyordered]")[.](#6.sentence-1)
[7](#7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L12677)
*Effects*: Equivalent to:return ranges::less{}(std::forward<U>(u), std::forward<T>(t));
[🔗](#lib:less)
struct ranges::less {template<class T, class U>constexpr bool operator()(T&& t, U&& u) const; using is_transparent = *unspecified*;};
[🔗](#itemdecl:4)
`template<class T, class U>
constexpr bool operator()(T&& t, U&& u) const;
`
[8](#8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L12701)
*Constraints*: T and U satisfy [totally_ordered_with](concept.totallyordered#concept:totally_ordered_with "18.5.5Concept totally_­ordered[concept.totallyordered]")[.](#8.sentence-1)
[9](#9)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L12705)
*Preconditions*: If the expression std::forward<T>(t) < std::forward<U>(u) results in a
call to a built-in operator < comparing pointers of type P, the
conversion sequences from both T and U to P are
equality-preserving ([[concepts.equality]](concepts.equality "18.2Equality preservation"));
otherwise, T and U model [totally_ordered_with](concept.totallyordered#concept:totally_ordered_with "18.5.5Concept totally_­ordered[concept.totallyordered]")[.](#9.sentence-1)
For any expressionsET and EU such that decltype((ET)) is T anddecltype((EU)) is U, exactly one ofranges::less{}(ET, EU),ranges::less{}(EU, ET), orranges::equal_to{}(ET, EU) is true[.](#9.sentence-2)
[10](#10)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L12720)
*Effects*:
- [(10.1)](#10.1)
If the expression std::forward<T>(t) < std::forward<U>(u) results in a
call to a built-in operator < comparing pointers:
returns true if (the converted value of) t precedes u in
the implementation-defined strict total order over pointers ([[defns.order.ptr]](defns.order.ptr "3.28implementation-defined strict total order over pointers"))
and otherwise false.
- [(10.2)](#10.2)
Otherwise, equivalent to:return std::forward<T>(t) < std::forward<U>(u);
[🔗](#lib:greater_equal)
struct ranges::greater_equal {template<class T, class U>constexpr bool operator()(T&& t, U&& u) const; using is_transparent = *unspecified*;};
[🔗](#itemdecl:5)
`template<class T, class U>
constexpr bool operator()(T&& t, U&& u) const;
`
[11](#11)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L12752)
*Constraints*: T and U satisfy [totally_ordered_with](concept.totallyordered#concept:totally_ordered_with "18.5.5Concept totally_­ordered[concept.totallyordered]")[.](#11.sentence-1)
[12](#12)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L12756)
*Effects*: Equivalent to:return !ranges::less{}(std::forward<T>(t), std::forward<U>(u));
[🔗](#lib:less_equal)
`struct ranges::less_equal {
template<class T, class U>
constexpr bool operator()(T&& t, U&& u) const;
using is_transparent = unspecified;
};
`
[🔗](#itemdecl:7)
`template<class T, class U>
constexpr bool operator()(T&& t, U&& u) const;
`
[13](#13)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L12780)
*Constraints*: T and U satisfy [totally_ordered_with](concept.totallyordered#concept:totally_ordered_with "18.5.5Concept totally_­ordered[concept.totallyordered]")[.](#13.sentence-1)
[14](#14)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/utilities.tex#L12784)
*Effects*: Equivalent to:return !ranges::less{}(std::forward<U>(u), std::forward<T>(t));