1 .. Algorithms/Querying Algorithms//count |40
17 typedef |unspecified| type;
25 Returns the number of elements in a ``Sequence`` that are identical to ``T``.
33 #include <boost/mpl/count.hpp>
39 +---------------+---------------------------+-----------------------------------+
40 | Parameter | Requirement | Description |
41 +===============+===========================+===================================+
42 | ``Sequence`` | |Forward Sequence| | A sequence to be examined. |
43 +---------------+---------------------------+-----------------------------------+
44 | ``T`` | Any type | A type to search for. |
45 +---------------+---------------------------+-----------------------------------+
52 For any |Forward Sequence| ``s`` and arbitrary type ``t``:
57 typedef count<s,t>::type n;
67 typedef count_if< s,is_same<_,T> >::type n;
73 Linear. Exactly ``size<s>::value`` comparisons for identity.
81 typedef vector<int,char,long,short,char,short,double,long> types;
82 typedef count<types, short>::type n;
84 BOOST_MPL_ASSERT_RELATION( n::value, ==, 2 );
90 |Querying Algorithms|, |count_if|, |find|, |find_if|, |contains|, |lower_bound|
93 .. copyright:: Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams
94 Distributed under the Boost Software License, Version 1.0. (See accompanying
95 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)