synth-three-way、synth-three-way-result
源自 zh.cppreference.net
constexpr auto synth-three-way = /* see below */;
|
(1) | (自 C++20 起) (仅用于阐述*) |
template< class T, class U = T >
using synth-three-way-result =
decltype(synth-three-way(std::declval<T&>(), std::declval<U&>()));
|
(2) | (自 C++20 起) (仅用于阐述*) |
1) 一个函数对象,其
operator() 行为类似于合成的三路比较函数。等价于:
constexpr auto synth-three-way =
[]<class T, class U>(const T& t, const U& u)
requires requires
{
{ t < u } -> boolean-testable;
{ u < t } -> boolean-testable;
}
{
if constexpr (std::three_way_comparable_with<T, U>)
return t <=> u;
else
{
if (t < u)
return std::weak_ordering::less;
if (u < t)
return std::weak_ordering::greater;
return std::weak_ordering::equivalent;
}
};
2)
operator() 中 (1)(synth-three-way)的返回类型。参数
| t, u | - | 待比较的值 |
返回值
比较结果。
另请参阅
|
(在 C++20 中移除)
(在 C++20 中移除)
(在 C++20 中移除)
(在 C++20 中移除)
(在 C++20 中移除)
(C++20)
|
按字典序比较
pair
中的值
(函数模板) |
|
(C++20中移除)
(C++20中移除)
(C++20中移除)
(C++20中移除)
(C++20中移除)
(C++20)
|
按字典序比较元组中的值
(函数模板) |
|
(C++11)
(C++11)
(C++20中移除)
(C++11)
(C++20中移除)
(C++11)
(C++20中移除)
(C++11)
(C++20中移除)
(C++11)
(C++20中移除)
(C++20)
|
按字典序比较两个
array
的值
(函数模板) |
|
(C++20中移除)
(C++20中移除)
(C++20中移除)
(C++20中移除)
(C++20中移除)
(C++20)
|
按字典序比较两个
deque
的值
(函数模板) |
|
(C++11)
(C++11)
(removed in C++20)
(C++11)
(removed in C++20)
(C++11)
(removed in C++20)
(C++11)
(removed in C++20)
(C++11)
(removed in C++20)
(C++20)
|
按字典序比较两个
forward_list
的值
(函数模板) |
|
(C++20中移除)
(C++20中移除)
(C++20中移除)
(C++20中移除)
(C++20中移除)
(C++20)
|
按字典序比较两个
list
的值
(函数模板) |
|
(C++20中移除)
(C++20中移除)
(C++20中移除)
(C++20中移除)
(C++20中移除)
(C++20)
|
按字典序比较两个
vector
的值
(函数模板) |
|
(C++20中移除)
(C++20中移除)
(C++20中移除)
(C++20中移除)
(C++20中移除)
(C++20)
|
按字典序比较两个
map
的值
(函数模板) |
|
(C++20中移除)
(C++20中移除)
(C++20中移除)
(C++20中移除)
(C++20中移除)
(C++20)
|
按字典序比较两个
multimap
的值
(函数模板) |
|
(C++20中移除)
(C++20中移除)
(C++20中移除)
(C++20中移除)
(C++20中移除)
(C++20)
|
按字典序比较两个
set
的值
(函数模板) |
|
(C++20中移除)
(C++20中移除)
(C++20中移除)
(C++20中移除)
(C++20中移除)
(C++20)
|
按字典序比较两个
multiset
的值
(函数模板) |