![]() |
Home | Libraries | People | FAQ | More |
Returns the number of elements of a given type within a sequence.
template< typename Sequence, typename T > typename result_of::count<Sequence, T>::type count( Sequence const& seq, T const& t);
Table 1.43. Parameters
Parameter | Requirement | Description |
---|---|---|
seq | A model of Forward Sequence, e == t must be a valid expression, convertible to bool, for each element e in seq | The sequence to search |
T | Any type | The type to count |
count(seq, t);
Return type: int
Semantics: Returns the number of elements of type T and equal to t in seq.
Linear. At most result_of::size<Sequence>::value comparisons.
#include <boost/fusion/algorithm/query/count.hpp>
const vector<double,int,int> vec(1.0,2,3); assert(count(vec,2) == 1);
Copyright © 2001-2005 Joel de Guzman, Dan Marsden |