/Src/Dependencies/Boost/libs/range/doc/reference/algorithm/adjacent_find.qbk

http://hadesmem.googlecode.com/ · text · 85 lines · 59 code · 26 blank · 0 comment · 0 complexity · 961209817b223def0ff070b48b55e46e MD5 · raw file

  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:adjacent_find adjacent_find]
  7. [heading Prototype]
  8. ``
  9. template<class ForwardRange>
  10. typename range_iterator<ForwardRange>::type
  11. adjacent_find(ForwardRange& rng);
  12. template<class ForwardRange>
  13. typename range_iterator<const ForwardRange>::type
  14. adjacent_find(const ForwardRange& rng);
  15. template<class ForwardRange, class BinaryPredicate>
  16. typename range_iterator<ForwardRange>::type
  17. adjacent_find(ForwardRange& rng, BinaryPred pred);
  18. template<class ForwardRange, class BinaryPredicate>
  19. typename range_iterator<const ForwardRange>::type
  20. adjacent_find(const ForwardRange& rng, BinaryPred pred);
  21. template<range_return_value_re, class ForwardRange>
  22. typename range_return<ForwardRange, re>::type
  23. adjacent_find(ForwardRange& rng);
  24. template<range_return_value_re, class ForwardRange>
  25. typename range_return<const ForwardRange, re>::type
  26. adjacent_find(const ForwardRange& rng);
  27. template<
  28. range_return_value re,
  29. class ForwardRange,
  30. class BinaryPredicate
  31. >
  32. typename range_return<ForwardRange, re>::type
  33. adjacent_find(ForwardRange& rng, BinaryPredicate pred);
  34. template<
  35. range_return_value re,
  36. class ForwardRange,
  37. class BinaryPredicate
  38. >
  39. typename range_return<const ForwardRange, re>::type
  40. adjacent_find(const ForwardRange& rng, BinaryPredicate pred);
  41. ``
  42. [heading Description]
  43. [*Non-predicate versions:]
  44. `adjacent_find` finds the first adjacent elements `[x,y]` in `rng` where `x == y`
  45. [*Predicate versions:]
  46. `adjacent_find` finds the first adjacent elements `[x,y]` in `rng` where `pred(x,y)` is `true`.
  47. [heading Definition]
  48. Defined in the header file `boost/range/algorithm/adjacent_find.hpp`
  49. [heading Requirements]
  50. [*For the non-predicate versions of adjacent_find:]
  51. * `ForwardRange` is a model of the __forward_range__ Concept.
  52. * `ForwardRange`'s value type is a model of the `EqualityComparableConcept`.
  53. [*For the predicate versions of adjacent_find:]
  54. * `ForwardRange` is a model of the __forward_range__ Concept.
  55. * `BinaryPredicate` is a model of the `BinaryPredicateConcept`.
  56. * `ForwardRange`'s value type is convertible to `BinaryPredicate`'s first argument type and to `BinaryPredicate`'s second argument type.
  57. [heading Complexity]
  58. Linear. If `empty(rng)` then no comparisons are performed; otherwise, at most `distance(rng) - 1` comparisons.
  59. [endsect]