HP Integrity NonStop H-Series User Manual
Page 172

InputInterator first2, InputIterator last2 [, BinaryFunction ] );
Unlike most of the other algorithms that take two sequences as an argument, the
lexicographical_compare() algorithm, uses a first and past-end iterator for both
sequences. A variation on the algorithm takes a fifth argument, which is the binary
function used to compare the corresponding elements from the two sequences.
The example program illustrates the use of this algorithm with character sequences, and with arrays of integer values.
void lexicographical_compare_example()
// illustrate the use of the lexicographical_compare algorithm
{
char * wordOne = "everything";
char * wordTwo = "everybody";
cout << "compare everybody to everything "<<
lexicographical_compare(wordTwo, wordTwo + strlen(wordTwo),
wordOne, wordOne + +strlen(wordOne)) << endl;
int a[] = {3, 4, 5, 2};
int b[] = {3, 4, 5};
int c[] = {3, 5};
cout << "compare a to b:" <<
lexicographical_compare(a, a+4, b, b+3) << endl;
cout << "compare a to c:" <<
lexicographical_compare(a, a+4, c, c+2) << endl;
}