lexicographical_compare

C/C++ Reference

lexicographical_compare
Syntax:
  #include <algorithm>
  bool lexicographical_compare( iterator start1, iterator end1, iterator start2, iterator end2 );
  bool lexicographical_compare( iterator start1, iterator end1, iterator start2, iterator end2, BinPred p );

The lexicographical_compare() function returns true if the range of elements [start1,end1) is lexicographically less than the range of elements [start2,end2).

If you're confused about what lexicographic means, it might help to know that dictionaries are ordered lexicographically.

lexicographical_compare() runs in linear time.

Related topics: