]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/mpl/doc/src/refmanual/has_key.rst
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / mpl / doc / src / refmanual / has_key.rst
CommitLineData
7c673cae
FG
1.. Sequences/Intrinsic Metafunctions//has_key
2
3has_key
4=======
5
6Synopsis
7--------
8
9.. parsed-literal::
10
11 template<
12 typename Sequence
13 , typename Key
14 >
15 struct has_key
16 {
17 typedef |unspecified| type;
18 };
19
20
21
22Description
23-----------
24
25Returns a true-valued |Integral Constant| if ``Sequence`` contains an element
26with key ``Key``.
27
28
29Header
30------
31
32.. parsed-literal::
33
34 #include <boost/mpl/has_key.hpp>
35
36
37Model of
38--------
39
40|Tag Dispatched Metafunction|
41
42
43Parameters
44----------
45
46+---------------+---------------------------+-----------------------------------------------+
47| Parameter | Requirement | Description |
48+===============+===========================+===============================================+
49| ``Sequence`` | |Associative Sequence| | A sequence to query. |
50+---------------+---------------------------+-----------------------------------------------+
51| ``Key`` | Any type | The queried key. |
52+---------------+---------------------------+-----------------------------------------------+
53
54
55Expression semantics
56--------------------
57
58For any |Associative Sequence| ``s``, and arbitrary type ``key``:
59
60.. parsed-literal::
61
62 typedef has_key<s,key>::type c;
63
64:Return type:
65 Boolean |Integral Constant|.
66
67:Semantics:
68 ``c::value == true`` if ``key`` is in ``s``'s set of keys; otherwise
69 ``c::value == false``.
70
71
72Complexity
73----------
74
75Amortized constant time.
76
77
78Example
79-------
80
81.. parsed-literal::
82
83 typedef map< pair<int,unsigned>, pair<char,long> > m;
84 BOOST_MPL_ASSERT_NOT(( has_key<m,long> ));
85
86 typedef insert< m, pair<long,unsigned long> > m1;
87 BOOST_MPL_ASSERT(( has_key<m1,long> ));
88
89
90See also
91--------
92
93|Associative Sequence|, |count|, |insert|, |erase_key|
94
95
96