]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mpl/doc/src/refmanual/key_type.rst
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / mpl / doc / src / refmanual / key_type.rst
1 .. Sequences/Intrinsic Metafunctions//key_type
2
3 key_type
4 ========
5
6 Synopsis
7 --------
8
9 .. parsed-literal::
10
11 template<
12 typename Sequence
13 , typename X
14 >
15 struct key_type
16 {
17 typedef |unspecified| type;
18 };
19
20
21
22 Description
23 -----------
24
25 Returns the |key| that would be used to identify ``X`` in ``Sequence``.
26
27
28 Header
29 ------
30
31 .. parsed-literal::
32
33 #include <boost/mpl/key_type.hpp>
34
35
36 Model of
37 --------
38
39 |Tag Dispatched Metafunction|
40
41
42 Parameters
43 ----------
44
45 +---------------+---------------------------+-----------------------------------------------+
46 | Parameter | Requirement | Description |
47 +===============+===========================+===============================================+
48 | ``Sequence`` | |Associative Sequence| | A sequence to query. |
49 +---------------+---------------------------+-----------------------------------------------+
50 | ``X`` | Any type | The type to get the |key| for. |
51 +---------------+---------------------------+-----------------------------------------------+
52
53
54 Expression semantics
55 --------------------
56
57 For any |Associative Sequence| ``s``, iterators ``pos1`` and ``pos2`` in ``s``, and an
58 artibrary type ``x``:
59
60 .. parsed-literal::
61
62 typedef key_type<s,x>::type k;
63
64 :Return type:
65 A type.
66
67 :Precondition:
68 ``x`` can be put in ``s``.
69
70 :Semantics:
71 ``k`` is the |key| that would be used to identify ``x`` in ``s``.
72
73 :Postcondition:
74 If ``key_type< s,deref<pos1>::type >::type`` is identical to
75 ``key_type< s,deref<pos2>::type >::type`` then ``pos1`` is identical to ``pos2``.
76
77
78
79 Complexity
80 ----------
81
82 Amortized constant time.
83
84
85 Example
86 -------
87
88 .. parsed-literal::
89
90 typedef key_type< map<>,pair<int,unsigned> >::type k1;
91 typedef key_type< set<>,pair<int,unsigned> >::type k2;
92
93 BOOST_MPL_ASSERT(( is_same< k1,int > ));
94 BOOST_MPL_ASSERT(( is_same< k2,pair<int,unsigned> > ));
95
96
97 See also
98 --------
99
100 |Associative Sequence|, |value_type|, |has_key|, |set|, |map|
101
102
103 .. copyright:: Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams
104 Distributed under the Boost Software License, Version 1.0. (See accompanying
105 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)