Boost
C++ Libraries
...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
This is an older version of Boost and was released in 2024. The current version is 1.90.0.
template<class SinglePassRange> bool is_sorted(const SinglePassRange& rng); template<class SinglePassRange, class BinaryPredicate> bool is_sorted(const SinglePassRange& rng, BinaryPredicate pred);
is_sorted determines
if a range is sorted. For the non-predicate version the return value
is true if and only if for
each adjacent elements [x, y]
the expression y <
x is false
(i.e., x <=
y), or if the number of elements
is zero or one. For the predicate version the return value is true is and only if for each adjacent
elements [x, y] the expression pred(y, x) is false,
or if the number of elements is zero or one.
Defined in the header file boost/range/algorithm_ext/is_sorted.hpp
SinglePassRange is
a model of the Single
Pass Range Concept.
BinaryPredicate is
a model of the BinaryPredicate
Concept.
SinglePassRange
is convertible to both argument types of BinaryPredicate.
Linear. A maximum of distance(rng) comparisons are performed.