3rdParty/boost/1.78.0/libs/mpl/doc/src/refmanual/count.rst
.. Algorithms/Querying Algorithms//count |40
.. parsed-literal::
template<
typename Sequence
, typename T
>
struct count
{
typedef |unspecified| type;
};
Returns the number of elements in a Sequence that are identical to T.
.. parsed-literal::
#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:
.. parsed-literal::
typedef count<s,t>::type n;
:Return type: |Integral Constant|.
:Semantics: Equivalent to
.. parsed-literal::
typedef count_if< s,is_same<_,T> >::type n;
Linear. Exactly size<s>::value comparisons for identity.
.. parsed-literal::
typedef vector<int,char,long,short,char,short,double,long> types;
typedef count<types, short>::type n;
BOOST_MPL_ASSERT_RELATION( n::value, ==, 2 );
|Querying Algorithms|, |count_if|, |find|, |find_if|, |contains|, |lower_bound|
.. copyright:: 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)