26 Algorithms library [algorithms]

26.8 Sorting and related operations [alg.sorting]

26.8.12 Three-way comparison algorithms [alg.three.way]

template<class InputIterator1, class InputIterator2, class Cmp> constexpr auto lexicographical_compare_three_way(InputIterator1 b1, InputIterator1 e1, InputIterator2 b2, InputIterator2 e2, Cmp comp) -> decltype(comp(*b1, *b2));
Let N be min(e1 - b1, e2 - b2).
Let E(n) be comp(*(b1 + n), *(b2 + n)).
Mandates: decltype(comp(*b1, *b2)) is a comparison category type.
Returns: E(i), where i is the smallest integer in [0, N) such that E(i) != 0 is true, or (e1 - b1) <=> (e2 - b2) if no such integer exists.
Complexity: At most N applications of comp.
template<class InputIterator1, class InputIterator2> constexpr auto lexicographical_compare_three_way(InputIterator1 b1, InputIterator1 e1, InputIterator2 b2, InputIterator2 e2);
Effects: Equivalent to: return lexicographical_compare_three_way(b1, e1, b2, e2, compare_three_way());