[#BloombergLP-bslalg-RangeCompare-lexicographical-07] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslalg.adoc[bslalg]::xref:BloombergLP/bslalg/RangeCompare.adoc[RangeCompare]::lexicographical :relfileprefix: ../../../ :mrdocs: 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. == Synopsis Declared in `<bslalg_rangecompare.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class INPUT_ITER> static int lexicographical( INPUT_ITER start1, INPUT_ITER end1, INPUT_ITER start2, INPUT_ITER end2); ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#