find_end.qbk 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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:find_end find_end]
  7. [heading Prototype]
  8. ``
  9. template<class ForwardRange1, class ForwardRange2>
  10. typename range_iterator<ForwardRange1>::type
  11. find_end(ForwardRange1& rng1, const ForwardRange2& rng2);
  12. template<
  13. class ForwardRange1,
  14. class ForwardRange2,
  15. class BinaryPredicate
  16. >
  17. typename range_iterator<ForwardRange1>::type
  18. find_end(ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred);
  19. template<
  20. range_return_value re,
  21. class ForwardRange1,
  22. class ForwardRange2
  23. >
  24. typename range_return<ForwardRange1, re>::type
  25. find_end(ForwardRange1& rng1, const ForwardRange2& rng2);
  26. template<
  27. range_return_value re,
  28. class ForwardRange1,
  29. class ForwardRange2,
  30. class BinaryPredicate
  31. >
  32. typename range_return<ForwardRange1, re>::type
  33. find_end(ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred);
  34. ``
  35. [heading Description]
  36. The versions of `find_end` that return an iterator, return an iterator to the beginning of the last sub-sequence equal to `rng2` within `rng1`.
  37. Equality is determined by `operator==` for non-predicate versions of `find_end`, and by satisfying `pred` in the predicate versions. The versions of `find_end` that return a `range_return`, defines `found` in the same manner as the returned iterator described above.
  38. [heading Definition]
  39. Defined in the header file `boost/range/algorithm/find_end.hpp`
  40. [heading Requirements]
  41. [*For the non-predicate versions:]
  42. * `ForwardRange1` is a model of the __forward_range__ Concept.
  43. * `ForwardRange2` is a model of the __forward_range__ Concept.
  44. * `ForwardRange1`'s value type is a model of the `EqualityComparableConcept`.
  45. * `ForwardRange2`'s value type is a model of the `EqualityComparableConcept`.
  46. * Objects of `ForwardRange1`'s value type can be compared for equality with objects of `ForwardRange2`'s value type.
  47. [*For the predicate versions:]
  48. * `ForwardRange1` is a model of the __forward_range__ Concept.
  49. * `ForwardRange2` is a model of the __forward_range__ Concept.
  50. * `BinaryPredicate` is a model of the `BinaryPredicateConcept`.
  51. * `ForwardRange1`'s value type is convertible to `BinaryPredicate`'s first argument type.
  52. * `ForwardRange2`'s value type is convertible to `BinaryPredicate`'s second argument type.
  53. [heading Complexity]
  54. The number of comparisons is proportional to `distance(rng1) * distance(rng2)`. If both `ForwardRange1` and `ForwardRange2` are models of `BidirectionalRangeConcept` then the average complexity is linear and the worst case is `distance(rng1) * distance(rng2)`.
  55. [endsect]