3rdParty/boost/1.78.0/libs/mpl/doc/refmanual/count-if.html
| Prev Next | Back Along | Up Home | Full TOC | Front Page / Algorithms / Querying Algorithms / count_if |
template<
typename Sequence
, typename Pred
>
struct[count\_if](./count-if.html){
typedef_unspecified_type;
};
Returns the number of elements in Sequence that satisfy the predicate Pred.
#include <[boost/mpl/count\_if.hpp](../../../../boost/mpl/count_if.hpp)>
| Parameter | Requirement | Description |
|---|---|---|
| Sequence | Forward Sequence | A sequence to be examined. |
| Pred | Unary Lambda Expression | A count condition. |
For any Forward Sequence s and unary Lambda Expression pred:
typedef[count\_if](./count-if.html)<s,pred>::type n;
| Return type: |
| | Semantics: |
Equivalent to
typedef[lambda](./lambda.html)<pred>::type p;
typedef[fold](./fold.html)<
s
,[long\_](./long.html)<0>
,[if\_](./if.html)<[apply\_wrap](./apply-wrap.html)1<p,[\_2](./placeholders.html)>,[next](./next.html)<[\_1](./placeholders.html)>,[\_1](./placeholders.html)>
>::type n;
|
Linear. Exactly size<s>::value applications of pred.
typedef[vector](./vector.html)<int,char,long,short,char,long,double,long> types;[BOOST\_MPL\_ASSERT\_RELATION](./assert-relation.html)( ([count\_if](./count-if.html)< types, is_float<_> >::value), ==, 1 );[BOOST\_MPL\_ASSERT\_RELATION](./assert-relation.html)( ([count\_if](./count-if.html)< types, is_same<_,char> >::value), ==, 2 );[BOOST\_MPL\_ASSERT\_RELATION](./assert-relation.html)( ([count\_if](./count-if.html)< types, is_same<_,void> >::value), ==, 0 );
Querying Algorithms, count, find, find_if, contains
| Prev Next | Back Along | Up Home | Full TOC |
Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |