Skip to content

Commit 27cad22

Browse files
authored
Merge 2019-07 LWG Motion 12
P1614R2 Adding <=> to the Library Fixes #3016.
2 parents 584a87e + 90f6479 commit 27cad22

15 files changed

+1029
-2646
lines changed

source/algorithms.tex

Lines changed: 15 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2830,19 +2830,17 @@
28302830
Proj1 proj1 = {}, Proj2 proj2 = {});
28312831
}
28322832

2833-
// \ref{alg.3way}, three-way comparison algorithms
2834-
template<class T, class U>
2835-
constexpr auto compare_3way(const T& a, const U& b);
2833+
// \ref{alg.three.way}, three-way comparison algorithms
28362834
template<class InputIterator1, class InputIterator2, class Cmp>
28372835
constexpr auto
2838-
lexicographical_compare_3way(InputIterator1 b1, InputIterator1 e1,
2839-
InputIterator2 b2, InputIterator2 e2,
2840-
Cmp comp)
2836+
lexicographical_compare_three_way(InputIterator1 b1, InputIterator1 e1,
2837+
InputIterator2 b2, InputIterator2 e2,
2838+
Cmp comp)
28412839
-> common_comparison_category_t<decltype(comp(*b1, *b2)), strong_ordering>;
28422840
template<class InputIterator1, class InputIterator2>
28432841
constexpr auto
2844-
lexicographical_compare_3way(InputIterator1 b1, InputIterator1 e1,
2845-
InputIterator2 b2, InputIterator2 e2);
2842+
lexicographical_compare_three_way(InputIterator1 b1, InputIterator1 e1,
2843+
InputIterator2 b2, InputIterator2 e2);
28462844

28472845
// \ref{alg.permutation.generators}, permutations
28482846
template<class BidirectionalIterator>
@@ -8367,46 +8365,15 @@
83678365
\end{note}
83688366
\end{itemdescr}
83698367

8370-
\rSec2[alg.3way]{Three-way comparison algorithms}
8368+
\rSec2[alg.three.way]{Three-way comparison algorithms}
83718369

8372-
\indexlibrary{\idxcode{compare_3way}}%
8373-
\begin{itemdecl}
8374-
template<class T, class U> constexpr auto compare_3way(const T& a, const U& b);
8375-
\end{itemdecl}
8376-
8377-
\begin{itemdescr}
8378-
\pnum
8379-
\effects
8380-
Compares two values and produces a result
8381-
of the strongest applicable comparison category type:
8382-
\begin{itemize}
8383-
\item
8384-
Returns \tcode{a <=> b} if that expression is well-formed.
8385-
\item
8386-
Otherwise, if the expressions \tcode{a == b} and \tcode{a < b}
8387-
are each well-formed and convertible to \tcode{bool},
8388-
returns \tcode{strong_ordering::equal}
8389-
when \tcode{a == b} is \tcode{true},
8390-
otherwise returns \tcode{strong_ordering::less}
8391-
when \tcode{a < b} is \tcode{true},
8392-
and otherwise returns \tcode{strong_ordering::greater}.
8393-
\item
8394-
Otherwise, if the expression \tcode{a == b}
8395-
is well-formed and convertible to \tcode{bool},
8396-
returns \tcode{strong_equality::equal} when \tcode{a == b} is \tcode{true},
8397-
and otherwise returns \tcode{strong_equality::nonequal}.
8398-
\item
8399-
Otherwise, the function is defined as deleted.
8400-
\end{itemize}
8401-
\end{itemdescr}
8402-
8403-
\indexlibrary{\idxcode{lexicographical_compare_3way}}%
8370+
\indexlibrary{\idxcode{lexicographical_compare_three_way}}%
84048371
\begin{itemdecl}
84058372
template<class InputIterator1, class InputIterator2, class Cmp>
84068373
constexpr auto
8407-
lexicographical_compare_3way(InputIterator1 b1, InputIterator1 e1,
8408-
InputIterator2 b2, InputIterator2 e2,
8409-
Cmp comp)
8374+
lexicographical_compare_three_way(InputIterator1 b1, InputIterator1 e1,
8375+
InputIterator2 b2, InputIterator2 e2,
8376+
Cmp comp)
84108377
-> common_comparison_category_t<decltype(comp(*b1, *b2)), strong_ordering>;
84118378
\end{itemdecl}
84128379

@@ -8431,23 +8398,20 @@
84318398
\end{codeblock}
84328399
\end{itemdescr}
84338400

8434-
\indexlibrary{\idxcode{lexicographical_compare_3way}}%
8401+
\indexlibrary{\idxcode{lexicographical_compare_three_way}}%
84358402
\begin{itemdecl}
84368403
template<class InputIterator1, class InputIterator2>
84378404
constexpr auto
8438-
lexicographical_compare_3way(InputIterator1 b1, InputIterator1 e1,
8439-
InputIterator2 b2, InputIterator2 e2);
8405+
lexicographical_compare_three_way(InputIterator1 b1, InputIterator1 e1,
8406+
InputIterator2 b2, InputIterator2 e2);
84408407
\end{itemdecl}
84418408

84428409
\begin{itemdescr}
84438410
\pnum
84448411
\effects
84458412
Equivalent to:
84468413
\begin{codeblock}
8447-
return lexicographical_compare_3way(b1, e1, b2, e2,
8448-
[](const auto& t, const auto& u) {
8449-
return compare_3way(t, u);
8450-
});
8414+
return lexicographical_compare_three_way(b1, e1, b2, e2, compare_three_way());
84518415
\end{codeblock}
84528416
\end{itemdescr}
84538417

0 commit comments

Comments
 (0)