Chris@16
|
1
|
Chris@16
|
2 #ifndef BOOST_MPL_MAP_AUX_ITEM_HPP_INCLUDED
|
Chris@16
|
3 #define BOOST_MPL_MAP_AUX_ITEM_HPP_INCLUDED
|
Chris@16
|
4
|
Chris@16
|
5 // Copyright Aleksey Gurtovoy 2003-2004
|
Chris@16
|
6 // Copyright David Abrahams 2003-2004
|
Chris@16
|
7 //
|
Chris@16
|
8 // Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
9 // (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
10 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
11 //
|
Chris@16
|
12 // See http://www.boost.org/libs/mpl for documentation.
|
Chris@16
|
13
|
Chris@101
|
14 // $Id$
|
Chris@101
|
15 // $Date$
|
Chris@101
|
16 // $Revision$
|
Chris@16
|
17
|
Chris@16
|
18 #include <boost/mpl/void.hpp>
|
Chris@16
|
19 #include <boost/mpl/pair.hpp>
|
Chris@16
|
20 #include <boost/mpl/long.hpp>
|
Chris@16
|
21 #include <boost/mpl/next.hpp>
|
Chris@16
|
22 #include <boost/mpl/prior.hpp>
|
Chris@16
|
23 #include <boost/mpl/map/aux_/map0.hpp>
|
Chris@16
|
24 #include <boost/mpl/aux_/order_impl.hpp>
|
Chris@16
|
25 #include <boost/mpl/aux_/yes_no.hpp>
|
Chris@16
|
26 #include <boost/mpl/aux_/type_wrapper.hpp>
|
Chris@16
|
27 #include <boost/mpl/aux_/config/arrays.hpp>
|
Chris@16
|
28 #include <boost/mpl/aux_/config/typeof.hpp>
|
Chris@16
|
29 #include <boost/mpl/aux_/config/ctps.hpp>
|
Chris@16
|
30
|
Chris@16
|
31
|
Chris@16
|
32 namespace boost { namespace mpl {
|
Chris@16
|
33
|
Chris@16
|
34 #if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES)
|
Chris@16
|
35
|
Chris@16
|
36 template< typename Key, typename T, typename Base >
|
Chris@16
|
37 struct m_item
|
Chris@16
|
38 : Base
|
Chris@16
|
39 {
|
Chris@16
|
40 typedef Key key_;
|
Chris@16
|
41 typedef pair<Key,T> item;
|
Chris@16
|
42 typedef Base base;
|
Chris@16
|
43
|
Chris@16
|
44 typedef typename next< typename Base::size >::type size;
|
Chris@16
|
45 typedef typename next< typename Base::order >::type order;
|
Chris@16
|
46
|
Chris@16
|
47 #if defined(BOOST_MPL_CFG_NO_DEPENDENT_ARRAY_TYPES)
|
Chris@16
|
48 typedef typename aux::weighted_tag<BOOST_MPL_AUX_MSVC_VALUE_WKND(order)::value>::type order_tag_;
|
Chris@16
|
49 #else
|
Chris@16
|
50 typedef char (&order_tag_)[BOOST_MPL_AUX_MSVC_VALUE_WKND(order)::value];
|
Chris@16
|
51 #endif
|
Chris@16
|
52
|
Chris@16
|
53 BOOST_MPL_AUX_MAP_OVERLOAD( aux::type_wrapper<T>, VALUE_BY_KEY, m_item, aux::type_wrapper<Key>* );
|
Chris@16
|
54 BOOST_MPL_AUX_MAP_OVERLOAD( aux::type_wrapper<item>, ITEM_BY_ORDER, m_item, order* );
|
Chris@16
|
55 BOOST_MPL_AUX_MAP_OVERLOAD( order_tag_, ORDER_BY_KEY, m_item, aux::type_wrapper<Key>* );
|
Chris@16
|
56 };
|
Chris@16
|
57
|
Chris@16
|
58
|
Chris@16
|
59 template< typename Key, typename Base >
|
Chris@16
|
60 struct m_mask
|
Chris@16
|
61 : Base
|
Chris@16
|
62 {
|
Chris@16
|
63 typedef void_ key_;
|
Chris@16
|
64 typedef Base base;
|
Chris@16
|
65
|
Chris@16
|
66 typedef typename prior< typename Base::size >::type size;
|
Chris@16
|
67 typedef typename x_order_impl<Base,Key>::type key_order_;
|
Chris@16
|
68
|
Chris@16
|
69 BOOST_MPL_AUX_MAP_OVERLOAD( aux::type_wrapper<void_>, VALUE_BY_KEY, m_mask, aux::type_wrapper<Key>* );
|
Chris@16
|
70 BOOST_MPL_AUX_MAP_OVERLOAD( aux::type_wrapper<void_>, ITEM_BY_ORDER, m_mask, key_order_* );
|
Chris@16
|
71 };
|
Chris@16
|
72
|
Chris@16
|
73 #else // BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES
|
Chris@16
|
74
|
Chris@16
|
75
|
Chris@16
|
76 # if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
Chris@16
|
77
|
Chris@16
|
78 template< long n, typename Key, typename T, typename Base >
|
Chris@16
|
79 struct m_item;
|
Chris@16
|
80
|
Chris@16
|
81 # else
|
Chris@16
|
82
|
Chris@16
|
83 template< long n >
|
Chris@16
|
84 struct m_item_impl
|
Chris@16
|
85 {
|
Chris@16
|
86 template< typename Key, typename T, typename Base >
|
Chris@16
|
87 struct result_;
|
Chris@16
|
88 };
|
Chris@16
|
89
|
Chris@16
|
90 template< long n, typename Key, typename T, typename Base >
|
Chris@16
|
91 struct m_item
|
Chris@16
|
92 : m_item_impl<n>::result_<Key,T,Base>
|
Chris@16
|
93 {
|
Chris@16
|
94 };
|
Chris@16
|
95
|
Chris@16
|
96
|
Chris@16
|
97 # endif
|
Chris@16
|
98
|
Chris@16
|
99
|
Chris@16
|
100 template< typename Key, typename T, typename Base >
|
Chris@16
|
101 struct m_item_
|
Chris@16
|
102 : Base
|
Chris@16
|
103 {
|
Chris@16
|
104 typedef Key key_;
|
Chris@16
|
105 typedef Base base;
|
Chris@16
|
106 typedef m_item_ type;
|
Chris@16
|
107
|
Chris@16
|
108 typedef typename next< typename Base::size >::type size;
|
Chris@16
|
109 typedef typename next< typename Base::order >::type order;
|
Chris@16
|
110
|
Chris@16
|
111 #if defined(BOOST_MPL_CFG_NO_DEPENDENT_ARRAY_TYPES)
|
Chris@16
|
112 typedef typename aux::weighted_tag<BOOST_MPL_AUX_MSVC_VALUE_WKND(order)::value>::type order_tag_;
|
Chris@16
|
113 #else
|
Chris@16
|
114 typedef char (&order_tag_)[BOOST_MPL_AUX_MSVC_VALUE_WKND(order)::value];
|
Chris@16
|
115 #endif
|
Chris@16
|
116
|
Chris@16
|
117 BOOST_MPL_AUX_MAP_OVERLOAD( order_tag_, ORDER_BY_KEY, m_item_, aux::type_wrapper<Key>* );
|
Chris@16
|
118 };
|
Chris@16
|
119
|
Chris@16
|
120 template< typename Key, typename Base >
|
Chris@16
|
121 struct m_mask
|
Chris@16
|
122 : Base
|
Chris@16
|
123 {
|
Chris@16
|
124 typedef void_ key_;
|
Chris@16
|
125 typedef Base base;
|
Chris@16
|
126
|
Chris@16
|
127 typedef typename prior< typename Base::size >::type size;
|
Chris@16
|
128 typedef typename x_order_impl<Base,Key>::type key_order_;
|
Chris@16
|
129
|
Chris@16
|
130 BOOST_MPL_AUX_MAP_OVERLOAD( aux::no_tag, ORDER_BY_KEY, m_mask, aux::type_wrapper<Key>* );
|
Chris@16
|
131 BOOST_MPL_AUX_MAP_OVERLOAD( aux::yes_tag, IS_MASKED, m_mask, key_order_* );
|
Chris@16
|
132 };
|
Chris@16
|
133
|
Chris@16
|
134 #endif // BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES
|
Chris@16
|
135
|
Chris@16
|
136 }}
|
Chris@16
|
137
|
Chris@16
|
138 #endif // BOOST_MPL_MAP_AUX_ITEM_HPP_INCLUDED
|