• 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:count count]
7
8[heading Prototype]
9
10``
11template<class SinglePassRange, class Value>
12typename range_difference<SinglePassRange>::type
13count(SinglePassRange& rng, const Value& val);
14
15template<class SinglePassRange, class Value>
16typename range_difference<const SinglePassRange>::type
17count(const SinglePassRange& rng, const Value& val);
18``
19
20[heading Description]
21
22`count` returns the number of elements `x` in `rng` where `x == val` is `true`.
23
24[heading Definition]
25
26Defined in the header file `boost/range/algorithm/count.hpp`
27
28[heading Requirements]
29
30* `SinglePassRange` is a model of the __single_pass_range__ Concept.
31* `Value` is a model of the `EqualityComparableConcept`.
32* `SinglePassRange`'s value type is a model of the `EqualityComparableConcept`.
33* An object of `SinglePassRange`'s value type can be compared for equality with an object of type `Value`.
34
35[heading Complexity]
36
37Linear. Exactly `distance(rng)` comparisons.
38
39[endsect]
40
41
42