Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext
is_sorted
Prototype

template<class SinglePassRange>
bool is_sorted(const SinglePassRange& rng);

template<class SinglePassRange, class BinaryPredicate>
bool is_sorted(const SinglePassRange& rng, BinaryPredicate pred);

Description

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 x < y is true. For the predicate version the return value is true is and only if for each adjacent elements [x,y] the expression pred(x,y) is true.

Definition

Defined in the header file boost/range/algorithm_ext/is_sorted.hpp

Requirements
  1. SinglePassRange is a model of the Single Pass Range Concept.
  2. BinaryPredicate is a model of the BinaryPredicate Concept.
  3. The value type of SinglePassRange is convertible to both argument types of BinaryPredicate.
Complexity

Linear. A maximum of distance(rng) comparisons are performed.


PrevUpHomeNext