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)
6 [section:search search]
11 template<class ForwardRange1, class ForwardRange2>
12 typename range_iterator<ForwardRange1>::type
13 search(ForwardRange1& rng1, const ForwardRange2& rng2);
15 template<class ForwardRange1, class ForwardRange2>
16 typename range_iterator<const ForwardRange1>::type
17 search(const ForwardRange1& rng1, const ForwardRange2& rng2);
24 typename range_iterator<ForwardRange1>::type,
25 search(ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred);
32 typename range_iterator<const ForwardRange1>::type
33 search(const ForwardRange1& rng1, ForwardRange2& rng2, BinaryPredicate pred);
37 range_return_value re,
41 typename range_return<ForwardRange1, re>::type
42 search(ForwardRange1& rng1, const ForwardRange2& rng2);
45 range_return_value re,
49 typename range_return<const ForwardRange1, re>::type
50 search(const ForwardRange1& rng1, const ForwardRange2& rng2);
53 range_return_value re,
58 typename range_return<ForwardRange1, re>::type,
59 search(ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred);
62 range_return_value re,
67 typename range_return<const ForwardRange1, re>::type
68 search(const ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred);
73 The versions of `search` that return an iterator, return an iterator to the start of the first subsequence in `rng1` that is equal to the subsequence `rng2`. The `end(rng1)` is returned if no such subsequence exists in `rng1`.
74 Equality is determined by `operator==` for non-predicate versions of `search`, and by satisfying `pred` in the predicate versions.
76 The versions of `search` that return a `range_return`, defines `found` in the same manner as the returned iterator described above.
80 Defined in the header file `boost/range/algorithm/search.hpp`
82 [heading Requirements]
84 [*For the non-predicate versions:]
86 * `ForwardRange1` is a model of the __forward_range__ Concept.
87 * `ForwardRange2` is a model of the __forward_range__ Concept.
88 * `ForwardRange1`'s value type is a model of the `EqualityComparableConcept`.
89 * `ForwardRange2`'s value type is a model of the `EqualityComparableConcept`.
90 * `ForwardRange1`s value type can be compared for equality with `ForwardRange2`'s value type.
92 [*For the predicate versions:]
94 * `ForwardRange1` is a model of the __forward_range__ Concept.
95 * `ForwardRange2` is a model of the __forward_range__ Concept.
96 * `BinaryPredicate` is a model of the `BinaryPredicateConcept`.
97 * `ForwardRange1`'s value type is convertible to `BinaryPredicate`'s first argument type.
98 * `ForwardRange2`'s value type is convertible to `BinaryPredicate`'s second argument type.
102 Average complexity is Linear. Worst-case complexity is quadratic.