Brian Silverman | 598d029 | 2018-08-04 23:56:47 -0700 | [diff] [blame^] | 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 | `` |
| 11 | template<class ForwardRange, class Integer, class Value> |
| 12 | typename range_iterator<ForwardRange>::type |
| 13 | search_n(ForwardRange& rng, Integer n, const Value& value); |
| 14 | |
| 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); |
| 18 | |
| 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); |
| 23 | |
| 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); |
| 28 | `` |
| 29 | |
| 30 | [heading Description] |
| 31 | |
| 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. |
| 35 | |
| 36 | [heading Definition] |
| 37 | |
| 38 | Defined 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 | |
| 59 | Average complexity is Linear. Worst-case complexity is quadratic. |
| 60 | |
| 61 | [endsect] |
| 62 | |
| 63 | |