• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1[/
2    Copyright 2010 Neil Groves
3    Distributed under the Boost Software License, Version 1.0.
4    (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5/]
6[section:is_sorted is_sorted]
7
8[heading Prototype]
9
10``
11template<class SinglePassRange>
12bool is_sorted(const SinglePassRange& rng);
13
14template<class SinglePassRange, class BinaryPredicate>
15bool is_sorted(const SinglePassRange& rng, BinaryPredicate pred);
16``
17
18[heading Description]
19
20`is_sorted` determines if a range is sorted.
21For the non-predicate version the return value is `true` if and only if for
22each adjacent elements `[x,y]` the expression `x < y` is `true`.
23For the predicate version the return value is `true` is and only if for each
24adjacent elements `[x,y]` the expression `pred(x,y)` is `true`.
25
26[heading Definition]
27
28Defined in the header file `boost/range/algorithm_ext/is_sorted.hpp`
29
30[heading Requirements]
31
32# `SinglePassRange` is a model of the __single_pass_range__ Concept.
33# `BinaryPredicate` is a model of the `BinaryPredicate` Concept.
34# The value type of `SinglePassRange` is convertible to both argument types of `BinaryPredicate`.
35
36[heading Complexity]
37
38Linear. A maximum of `distance(rng)` comparisons are performed.
39
40[endsect]
41