Front Page / Algorithms / Querying Algorithms / count |
Returns the number of elements in a Sequence that are identical to T.
#include <boost/mpl/count.hpp>
Parameter | Requirement | Description |
---|---|---|
Sequence | Forward Sequence | A sequence to be examined. |
T | Any type | A type to search for. |
For any Forward Sequence s and arbitrary type t:
typedef count<s,t>::type n;
Return type: | Integral Constant. |
---|---|
Semantics: | Equivalent to typedef count_if< s,is_same<_,T> >::type n; |
Linear. Exactly size<s>::value comparisons for identity.
typedef vector<int,char,long,short,char,short,double,long> types; typedef count<types, short>::type n; BOOST_MPL_ASSERT_RELATION( n::value, ==, 2 );