Tuple Comparison
Sunday, 27. August 2017 12:29PM
#tuple 比较运算符
tuple的比较规则与pair类似。以下摘录自INCITS/ISO/IEC 14882-2012
~~~
template<class… TTypes, class… UTypes>
bool operator<(const tuple
Requires: For all i, where 0 <= i and i < sizeof…(Types), get(t) < get(u) and get(u) < get(t) are valid expressions returning types that are convertible to bool. sizeof…(TTypes) == sizeof…(UTypes).
Returns: The result of a lexicographical comparison between t and u. The result is defined as:
(bool)(get<0>(t) < get<0>(u)) || (!(bool)(get<0>(u) < get<0>(t)) && t tail < u tail ), where
r tail for some tuple r is a tuple containing all but the first element of r. For any two zero-length tuples
e and f, e < f returns false.
~~~
The result is defined as:
==(bool)(get<0>(t) < get<0>(u)) || (!(bool)(get<0>(u) < get<0>(t)) && t tail < u tail )==