Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/mpl/doc/src/refmanual/count.rst @ 12

Last change on this file since 12 was 12, checked in by landauf, 18 years ago

added boost

File size: 1.7 KB

count

Synopsis

template<
      typename Sequence
    , typename T
    >
struct count
{
    typedef |unspecified| type;
};

Description

Returns the number of elements in a Sequence that are identical to T.

Parameters

Parameter Requirement Description
Sequence |Forward Sequence| A sequence to be examined.
T Any type A type to search for.

Expression semantics

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;

Complexity

Linear. Exactly size<s>::value comparisons for identity.

Example

typedef vector<int,char,long,short,char,short,double,long> types;
typedef count<types, short>::type n;
BOOST_MPL_ASSERT_RELATION( n::value, ==, 2 );

Docutils System Messages

??????????
Note: See TracBrowser for help on using the repository browser.