lexicographical_compare [C++ Reference]
Keywords: stl,algorithm,lexicographical_compare
Date: 2009-10-09T02:12:27-0700

## lexicographical_compare

Syntax:

        #include <algorithm>
        bool lexicographical_compare( input_iterator start1, input_iterator end1, input_iterator2 start2, input_iterator2 end2 );
        bool lexicographical_compare( input_iterator start1, input_iterator end1, input_iterator2 start2, input_iterator2 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: equal, lexicographical_compare_3way, mismatch, search