lexicographical_compare_3way

C/C++ Reference

lexicographical_compare_3way
Syntax:
  #include <algorithm>
  int lexicographical_compare_3way( iterator start1, iterator end1, iterator start2, iterator end2 );

The lexicographical_compare_3way() function compares the first range, defined by [start1,end1) to the second range, defined by [start2,end2).

If the first range is lexicographically less than the second range, this function returns a negative number. If the first range is lexicographically greater than the second, a positive number is returned. Zero is returned if neither range is lexicographically greater than the other.

lexicographical_compare_3way() runs in linear time.

Related topics: