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_n search_n]
11 template<class ForwardRange, class Integer, class Value>
12 typename range_iterator<ForwardRange>::type
13 search_n(ForwardRange& rng, Integer n, const Value& value);
15 template<class ForwardRange, class Integer, class Value>
16 typename range_iterator<const ForwardRange>::type
17 search_n(const ForwardRange& rng, Integer n, const Value& value);
19 template<class ForwardRange, class Integer, class Value, class BinaryPredicate>
20 typename range_iterator<ForwardRange>::type
21 search_n(ForwardRange& rng, Integer n, const Value& value,
22 BinaryPredicate binary_pred);
24 template<class ForwardRange, class Integer, class Value, class BinaryPredicate>
25 typename range_iterator<const ForwardRange>::type
26 search_n(const ForwardRange& rng, Integer n, const Value& value,
27 BinaryPredicate binary_pred);
32 `search_n` searches `rng` for a sequence of length `n` equal to `value` where
33 equality is determined by operator== in the non-predicate case, and by a
34 predicate when one is supplied.
38 Defined in the header file `boost/range/algorithm/search_n.hpp`
40 [heading Requirements]
42 [*For the non-predicate versions:]
44 * `ForwardRange` is a model of the __forward_range__ Concept.
45 * `ForwardRange`'s value type is a model of the `EqualityComparableConcept`.
46 * `ForwardRange`s value type can be compared for equality with `Value`.
47 * `Integer` is a model of the `IntegerConcept`.
49 [*For the predicate versions:]
51 * `ForwardRange` is a model of the __forward_range__ Concept.
52 * `BinaryPredicate` is a model of the `BinaryPredicateConcept`.
53 * `ForwardRange`'s value type is convertible to `BinaryPredicate`'s first argument type.
54 * `Value` is convertible to `BinaryPredicate`'s second argument type.
55 * `Integer` is a model of the `IntegerConcept`.
59 Average complexity is Linear. Worst-case complexity is quadratic.