|
4031 | 4031 | template<class T, class U = T>
|
4032 | 4032 | using compare_three_way_result_t = typename compare_three_way_result<T, U>::type;
|
4033 | 4033 |
|
4034 |
| - // \ref{cmp.object}, class \tcode{compare_three_way} |
| 4034 | + // \ref{comparisons.three.way}, class \tcode{compare_three_way} |
4035 | 4035 | struct compare_three_way;
|
4036 | 4036 |
|
4037 | 4037 | // \ref{cmp.alg}, comparison algorithms
|
|
4665 | 4665 | denotes the type \tcode{decltype(t <=> u)}.
|
4666 | 4666 | Otherwise, there is no member \tcode{type}.
|
4667 | 4667 |
|
4668 |
| -\rSec2[cmp.object]{Class \tcode{compare_three_way}} |
4669 |
| - |
4670 |
| -\pnum |
4671 |
| -In this subclause, \tcode{\placeholdernc{BUILTIN-PTR-THREE-WAY}(T, U)} |
4672 |
| -for types \tcode{T} and \tcode{U} is a boolean constant expression. |
4673 |
| -\tcode{\placeholdernc{BUILTIN-PTR-THREE-WAY}(T, U)} is \tcode{true} |
4674 |
| -if and only if \tcode{<=>} in the expression |
4675 |
| -\begin{codeblock} |
4676 |
| -declval<T>() <=> declval<U>() |
4677 |
| -\end{codeblock} |
4678 |
| -resolves to a built-in operator comparing pointers. |
4679 |
| - |
4680 |
| -\indexlibraryglobal{compare_three_way}% |
4681 |
| -\begin{codeblock} |
4682 |
| -struct compare_three_way { |
4683 |
| - template<class T, class U> |
4684 |
| - requires three_way_comparable_with<T, U> || @\placeholdernc{BUILTIN-PTR-THREE-WAY}@(T, U) |
4685 |
| - constexpr auto operator()(T&& t, U&& u) const; |
4686 |
| - |
4687 |
| - using is_transparent = @\unspec@; |
4688 |
| -}; |
4689 |
| -\end{codeblock} |
4690 |
| - |
4691 |
| -\pnum |
4692 |
| -In addition to being available via inclusion of the \libheader{compare} header, |
4693 |
| -the class \tcode{compare_three_way} is available |
4694 |
| -when the header \libheaderref{functional} is included. |
4695 |
| - |
4696 |
| -\begin{itemdecl} |
4697 |
| -template<class T, class U> |
4698 |
| - requires three_way_comparable_with<T, U> || @\placeholdernc{BUILTIN-PTR-THREE-WAY}@(T, U) |
4699 |
| -constexpr auto operator()(T&& t, U&& u) const; |
4700 |
| -\end{itemdecl} |
4701 |
| - |
4702 |
| -\begin{itemdescr} |
4703 |
| -\pnum |
4704 |
| -\expects |
4705 |
| -If the expression \tcode{std::forward<T>(t) <=> std::forward<U>(u)} results in |
4706 |
| -a call to a built-in operator \tcode{<=>} comparing pointers of type \tcode{P}, |
4707 |
| -the conversion sequences from both \tcode{T} and \tcode{U} to \tcode{P} |
4708 |
| -are equality-preserving\iref{concepts.equality}. |
4709 |
| - |
4710 |
| -\pnum |
4711 |
| -\effects |
4712 |
| -\begin{itemize} |
4713 |
| -\item |
4714 |
| - If the expression \tcode{std::forward<T>(t) <=> std::forward<U>(u)} results in |
4715 |
| - a call to a built-in operator \tcode{<=>} comparing pointers of type \tcode{P}, |
4716 |
| - returns \tcode{strong_ordering::less} |
4717 |
| - if (the converted value of) \tcode{t} precedes \tcode{u} |
4718 |
| - in the implementation-defined strict total order |
4719 |
| - over pointers\iref{defns.order.ptr}, |
4720 |
| - \tcode{strong_ordering::greater} |
4721 |
| - if \tcode{u} precedes \tcode{t}, and |
4722 |
| - otherwise \tcode{strong_ordering::equal}. |
4723 |
| -\item |
4724 |
| - Otherwise, equivalent to: \tcode{return std::forward<T>(t) <=> std::forward<U>(u);} |
4725 |
| -\end{itemize} |
4726 |
| -\end{itemdescr} |
4727 |
| - |
4728 | 4668 | \rSec2[cmp.alg]{Comparison algorithms}
|
4729 | 4669 |
|
4730 | 4670 | \indexlibraryglobal{strong_order}%
|
|
0 commit comments