]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mpl/doc/src/refmanual/count.rst
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / mpl / doc / src / refmanual / count.rst
1 .. Algorithms/Querying Algorithms//count |40
2
3 count
4 =====
5
6 Synopsis
7 --------
8
9 .. parsed-literal::
10
11 template<
12 typename Sequence
13 , typename T
14 >
15 struct count
16 {
17 typedef |unspecified| type;
18 };
19
20
21
22 Description
23 -----------
24
25 Returns the number of elements in a ``Sequence`` that are identical to ``T``.
26
27
28 Header
29 ------
30
31 .. parsed-literal::
32
33 #include <boost/mpl/count.hpp>
34
35
36 Parameters
37 ----------
38
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 +---------------+---------------------------+-----------------------------------+
46
47
48 Expression semantics
49 --------------------
50
51
52 For any |Forward Sequence| ``s`` and arbitrary type ``t``:
53
54
55 .. parsed-literal::
56
57 typedef count<s,t>::type n;
58
59 :Return type:
60 |Integral Constant|.
61
62 :Semantics:
63 Equivalent to
64
65 .. parsed-literal::
66
67 typedef count_if< s,is_same<_,T> >::type n;
68
69
70 Complexity
71 ----------
72
73 Linear. Exactly ``size<s>::value`` comparisons for identity.
74
75
76 Example
77 -------
78
79 .. parsed-literal::
80
81 typedef vector<int,char,long,short,char,short,double,long> types;
82 typedef count<types, short>::type n;
83
84 BOOST_MPL_ASSERT_RELATION( n::value, ==, 2 );
85
86
87 See also
88 --------
89
90 |Querying Algorithms|, |count_if|, |find|, |find_if|, |contains|, |lower_bound|
91
92
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)