Home | Libraries | People | FAQ | More |
template< class SinglePassRange1, class SinglePassRange2 > bool lexicographical_compare(const SinglePassRange1& rng1, const SinglePassRange2& rng2); template< class SinglePassRange1, class SinglePassRange2, class BinaryPredicate > bool lexicographical_compare(const SinglePassRange1& rng1, const SinglePassRange2& rng2, BinaryPredicate pred);
lexicographical_compare
compares element by element rng1
against rng2
. If the
element from rng1
is
less than the element from rng2
then true
is returned. If
the end of rng1
without
reaching the end of rng2
this also causes the return value to be true
.
The return value is false
in all other circumstances. The elements are compared using operator<
in the non-predicate versions of lexicographical_compare
and using pred
in the
predicate versions.
Defined in the header file boost/range/algorithm/lexicographical_compare.hpp
For the non-predicate versions of lexicographical_compare:
SinglePassRange1
is a model of the Single
Pass Range Concept.
SinglePassRange2
is a model of the Single
Pass Range Concept.
SinglePassRange1
's
value type is a model of the LessThanComparableConcept
.
SinglePassRange2
's
value type is a model of the LessThanComparableConcept
.
x
be an object
of SinglePassRange1
's
value type. Let y
be an object of SinglePassRange2
's
value type. x <
y
must be valid. y <
x
must be valid.
For the predicate versions of lexicographical_compare:
SinglePassRange1
is a model of the Single
Pass Range Concept.
SinglePassRange2
is a model of the Single
Pass Range Concept.
BinaryPredicate
is
a model of the BinaryPredicateConcept
.
SinglePassRange1
's
value type is convertible to BinaryPredicate
's
first argument type.
SinglePassRange2
's
value type is convertible to BinaryPredicate
's
second argument type.
Linear. At most 2 *
min(distance(rng1), distance(rng2))
comparisons.