]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | .. Sequences/Intrinsic Metafunctions//order |
2 | ||
3 | order | |
4 | ===== | |
5 | ||
6 | Synopsis | |
7 | -------- | |
8 | ||
9 | .. parsed-literal:: | |
10 | ||
11 | template< | |
12 | typename Sequence | |
13 | , typename Key | |
14 | > | |
15 | struct order | |
16 | { | |
17 | typedef |unspecified| type; | |
18 | }; | |
19 | ||
20 | ||
21 | ||
22 | Description | |
23 | ----------- | |
24 | ||
25 | Returns a unique unsigned |Integral Constant| associated with the key ``Key`` in | |
26 | ``Sequence``. | |
27 | ||
28 | ||
29 | Header | |
30 | ------ | |
31 | ||
32 | .. parsed-literal:: | |
33 | ||
34 | #include <boost/mpl/order.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 order<s,key>::type n; | |
63 | ||
64 | :Return type: | |
65 | Unsigned |Integral Constant|. | |
66 | ||
67 | :Semantics: | |
68 | If ``has_key<s,key>::value == true``, ``n`` is a unique unsigned | |
69 | |Integral Constant| associated with ``key`` in ``s``; otherwise, | |
70 | ``n`` is identical to ``void_``. | |
71 | ||
72 | ||
73 | Complexity | |
74 | ---------- | |
75 | ||
76 | Amortized constant time. | |
77 | ||
78 | ||
79 | Example | |
80 | ------- | |
81 | ||
82 | .. parsed-literal:: | |
83 | ||
84 | typedef map< pair<int,unsigned>, pair<char,long> > m; | |
85 | ||
86 | BOOST_MPL_ASSERT_NOT(( is_same< order<m,int>::type, void\_ > )); | |
87 | BOOST_MPL_ASSERT(( is_same< order<m,long>::type,void\_ > )); | |
88 | ||
89 | ||
90 | ||
91 | See also | |
92 | -------- | |
93 | ||
94 | |Associative Sequence|, |has_key|, |count|, |map| | |
95 | ||
96 | ||
97 |