• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. Sequences/Intrinsic Metafunctions//order
2
3order
4=====
5
6Synopsis
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
22Description
23-----------
24
25Returns a unique unsigned |Integral Constant| associated with the key ``Key`` in
26``Sequence``.
27
28
29Header
30------
31
32.. parsed-literal::
33
34    #include <boost/mpl/order.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 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
73Complexity
74----------
75
76Amortized constant time.
77
78
79Example
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
91See also
92--------
93
94|Associative Sequence|, |has_key|, |count|, |map|
95
96
97.. copyright:: Copyright �  2001-2009 Aleksey Gurtovoy and David Abrahams
98   Distributed under the Boost Software License, Version 1.0. (See accompanying
99   file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
100