|  | Home | Libraries | People | FAQ | More | 
            Returns the number of elements within a sequence with a type for which
            a given unary function object evaluates to true.
          
template<
    typename Sequence,
    typename F
    >
typename result_of::count_if<Sequence, F>::type count_if(
    Sequence const& seq, F f);
Table 1.58. Parameters
| Parameter | Requirement | Description | 
|---|---|---|
| 
                       | 
                      A model of Forward
                      Sequence,  | The sequence to search | 
| 
                       | A unary function object | The search predicate | 
count_if(seq, f)
            Return type: int
          
            Semantics: Returns the number of elements
            in seq where f evaluates to true.
          
            Linear. At most result_of::size<Sequence>::value
#include <boost/fusion/algorithm/query/count_if.hpp> #include <boost/fusion/include/count_if.hpp>
constvector<int,int,int> vec(1,2,3); assert(count_if(vec,odd()) == 2);