2 #ifndef BOOST_MPL_MAP_AUX_ITEM_HPP_INCLUDED
3 #define BOOST_MPL_MAP_AUX_ITEM_HPP_INCLUDED
5 // Copyright Aleksey Gurtovoy 2003-2004
6 // Copyright David Abrahams 2003-2004
8 // Distributed under the Boost Software License, Version 1.0.
9 // (See accompanying file LICENSE_1_0.txt or copy at
10 // http://www.boost.org/LICENSE_1_0.txt)
12 // See http://www.boost.org/libs/mpl for documentation.
18 #include <boost/mpl/void.hpp>
19 #include <boost/mpl/pair.hpp>
20 #include <boost/mpl/long.hpp>
21 #include <boost/mpl/next.hpp>
22 #include <boost/mpl/prior.hpp>
23 #include <boost/mpl/map/aux_/map0.hpp>
24 #include <boost/mpl/aux_/order_impl.hpp>
25 #include <boost/mpl/aux_/yes_no.hpp>
26 #include <boost/mpl/aux_/type_wrapper.hpp>
27 #include <boost/mpl/aux_/config/arrays.hpp>
28 #include <boost/mpl/aux_/config/typeof.hpp>
29 #include <boost/mpl/aux_/config/ctps.hpp>
32 namespace boost { namespace mpl {
34 #if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES)
36 template< typename Key, typename T, typename Base >
41 typedef pair<Key,T> item;
45 typedef typename next< typename Base::size >::type size;
46 typedef typename next< typename Base::order >::type order;
48 #if defined(BOOST_MPL_CFG_NO_DEPENDENT_ARRAY_TYPES)
49 typedef typename aux::weighted_tag<BOOST_MPL_AUX_MSVC_VALUE_WKND(order)::value>::type order_tag_;
51 typedef char (&order_tag_)[BOOST_MPL_AUX_MSVC_VALUE_WKND(order)::value];
54 BOOST_MPL_AUX_MAP_OVERLOAD( aux::type_wrapper<T>, VALUE_BY_KEY, m_item, aux::type_wrapper<Key>* );
55 BOOST_MPL_AUX_MAP_OVERLOAD( aux::type_wrapper<item>, ITEM_BY_ORDER, m_item, order* );
56 BOOST_MPL_AUX_MAP_OVERLOAD( order_tag_, ORDER_BY_KEY, m_item, aux::type_wrapper<Key>* );
60 template< typename Key, typename Base >
68 typedef typename prior< typename Base::size >::type size;
69 typedef typename x_order_impl<Base,Key>::type key_order_;
71 BOOST_MPL_AUX_MAP_OVERLOAD( aux::type_wrapper<void_>, VALUE_BY_KEY, m_mask, aux::type_wrapper<Key>* );
72 BOOST_MPL_AUX_MAP_OVERLOAD( aux::type_wrapper<void_>, ITEM_BY_ORDER, m_mask, key_order_* );
75 #else // BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES
78 # if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
80 template< long n, typename Key, typename T, typename Base >
88 template< typename Key, typename T, typename Base >
92 template< long n, typename Key, typename T, typename Base >
94 : m_item_impl<n>::result_<Key,T,Base>
102 template< typename Key, typename T, typename Base >
108 typedef m_item_ type;
110 typedef typename next< typename Base::size >::type size;
111 typedef typename next< typename Base::order >::type order;
113 #if defined(BOOST_MPL_CFG_NO_DEPENDENT_ARRAY_TYPES)
114 typedef typename aux::weighted_tag<BOOST_MPL_AUX_MSVC_VALUE_WKND(order)::value>::type order_tag_;
116 typedef char (&order_tag_)[BOOST_MPL_AUX_MSVC_VALUE_WKND(order)::value];
119 BOOST_MPL_AUX_MAP_OVERLOAD( order_tag_, ORDER_BY_KEY, m_item_, aux::type_wrapper<Key>* );
122 template< typename Key, typename Base >
130 typedef typename prior< typename Base::size >::type size;
131 typedef typename x_order_impl<Base,Key>::type key_order_;
133 BOOST_MPL_AUX_MAP_OVERLOAD( aux::no_tag, ORDER_BY_KEY, m_mask, aux::type_wrapper<Key>* );
134 BOOST_MPL_AUX_MAP_OVERLOAD( aux::yes_tag, IS_MASKED, m_mask, key_order_* );
137 #endif // BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES
141 #endif // BOOST_MPL_MAP_AUX_ITEM_HPP_INCLUDED