]> git.proxmox.com Git - ceph.git/blob - 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
1 .. Sequences/Intrinsic Metafunctions//has_key
2
3 has_key
4 =======
5
6 Synopsis
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
22 Description
23 -----------
24
25 Returns a true-valued |Integral Constant| if ``Sequence`` contains an element
26 with key ``Key``.
27
28
29 Header
30 ------
31
32 .. parsed-literal::
33
34 #include <boost/mpl/has_key.hpp>
35
36
37 Model of
38 --------
39
40 |Tag Dispatched Metafunction|
41
42
43 Parameters
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
55 Expression semantics
56 --------------------
57
58 For 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
72 Complexity
73 ----------
74
75 Amortized constant time.
76
77
78 Example
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
90 See also
91 --------
92
93 |Associative Sequence|, |count|, |insert|, |erase_key|
94
95
96 .. copyright:: Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams
97 Distributed under the Boost Software License, Version 1.0. (See accompanying
98 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)