is_sorted.qbk 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. [heading Prototype]
  8. ``
  9. template<class SinglePassRange>
  10. bool is_sorted(const SinglePassRange& rng);
  11. template<class SinglePassRange, class BinaryPredicate>
  12. bool is_sorted(const SinglePassRange& rng, BinaryPredicate pred);
  13. ``
  14. [heading Description]
  15. `is_sorted` determines if a range is sorted.
  16. For the non-predicate version the return value is `true` if and only if for
  17. each adjacent elements `[x,y]` the expression `x < y` is `true`.
  18. For the predicate version the return value is `true` is and only if for each
  19. adjacent elements `[x,y]` the expression `pred(x,y)` is `true`.
  20. [heading Definition]
  21. Defined in the header file `boost/range/algorithm_ext/is_sorted.hpp`
  22. [heading Requirements]
  23. # `SinglePassRange` is a model of the __single_pass_range__ Concept.
  24. # `BinaryPredicate` is a model of the `BinaryPredicate` Concept.
  25. # The value type of `SinglePassRange` is convertible to both argument types of `BinaryPredicate`.
  26. [heading Complexity]
  27. Linear. A maximum of `distance(rng)` comparisons are performed.
  28. [endsect]