Compare two ranges in lexicographical order.
Declared in <bslalg_rangecompare.h>
template<class INPUT_ITER>
static
int
lexicographical(
INPUT_ITER start1,
INPUT_ITER end1,
INPUT_ITER start2,
INPUT_ITER end2);
Compare each element in the range beginning at the specified start1 position and ending immediately before the specified end1 position, to the corresponding element in the range beginning at the specified start2 position and ending immediately before the specified end2 position. Optionally specify the length of each range, length1 and length2. Return a negative value if the first range compares lexicographically less than the second range, 0 if they are the same length and compare lexicographically equal, and a positive value if the first range compares lexicographically greater than the second range. The behavior is undefined unless length1 is either unspecified or equals the length of the range [start1, end1)], and length2 is either unspecified or equals the length of the range [start2, end2)]. Note that this implementation uses std::memcmp for unsigned character comparisons, std::wmemcmp for wide character comparisons, and operator< for all other types.
a negative value if the first range is less, 0 if equal, and a positive value if the first range is greater
| Name | Description |
|---|---|
| start1 | beginning of the first range |
| end1 | end of the first range (one past the last element) |
| start2 | beginning of the second range |
| end2 | end of the second range (one past the last element) |