• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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:search_n search_n]
7
8[heading Prototype]
9
10``
11template<class ForwardRange, class Integer, class Value>
12typename range_iterator<ForwardRange>::type
13search_n(ForwardRange& rng, Integer n, const Value& value);
14
15template<class ForwardRange, class Integer, class Value>
16typename range_iterator<const ForwardRange>::type
17search_n(const ForwardRange& rng, Integer n, const Value& value);
18
19template<class ForwardRange, class Integer, class Value, class BinaryPredicate>
20typename range_iterator<ForwardRange>::type
21search_n(ForwardRange& rng, Integer n, const Value& value,
22         BinaryPredicate binary_pred);
23
24template<class ForwardRange, class Integer, class Value, class BinaryPredicate>
25typename range_iterator<const ForwardRange>::type
26search_n(const ForwardRange& rng, Integer n, const Value& value,
27         BinaryPredicate binary_pred);
28``
29
30[heading Description]
31
32`search_n` searches `rng` for a sequence of length `n` equal to `value` where
33equality is determined by operator== in the non-predicate case, and by a
34predicate when one is supplied.
35
36[heading Definition]
37
38Defined in the header file `boost/range/algorithm/search_n.hpp`
39
40[heading Requirements]
41
42[*For the non-predicate versions:]
43
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`.
48
49[*For the predicate versions:]
50
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`.
56
57[heading Complexity]
58
59Average complexity is Linear. Worst-case complexity is quadratic.
60
61[endsect]
62
63
64