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;
44 typedef typename next< typename Base::size >::type size;
45 typedef typename next< typename Base::order >::type order;
47 #if defined(BOOST_MPL_CFG_NO_DEPENDENT_ARRAY_TYPES)
48 typedef typename aux::weighted_tag<BOOST_MPL_AUX_MSVC_VALUE_WKND(order)::value>::type order_tag_;
50 typedef char (&order_tag_)[BOOST_MPL_AUX_MSVC_VALUE_WKND(order)::value];
53 BOOST_MPL_AUX_MAP_OVERLOAD( aux::type_wrapper<T>, VALUE_BY_KEY, m_item, aux::type_wrapper<Key>* );
54 BOOST_MPL_AUX_MAP_OVERLOAD( aux::type_wrapper<item>, ITEM_BY_ORDER, m_item, order* );
55 BOOST_MPL_AUX_MAP_OVERLOAD( order_tag_, ORDER_BY_KEY, m_item, aux::type_wrapper<Key>* );
59 template< typename Key, typename Base >
66 typedef typename prior< typename Base::size >::type size;
67 typedef typename x_order_impl<Base,Key>::type key_order_;
69 BOOST_MPL_AUX_MAP_OVERLOAD( aux::type_wrapper<void_>, VALUE_BY_KEY, m_mask, aux::type_wrapper<Key>* );
70 BOOST_MPL_AUX_MAP_OVERLOAD( aux::type_wrapper<void_>, ITEM_BY_ORDER, m_mask, key_order_* );
73 #else // BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES
76 # if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
78 template< long n, typename Key, typename T, typename Base >
86 template< typename Key, typename T, typename Base >
90 template< long n, typename Key, typename T, typename Base >
92 : m_item_impl<n>::result_<Key,T,Base>
100 template< typename Key, typename T, typename Base >
106 typedef m_item_ type;
108 typedef typename next< typename Base::size >::type size;
109 typedef typename next< typename Base::order >::type order;
111 #if defined(BOOST_MPL_CFG_NO_DEPENDENT_ARRAY_TYPES)
112 typedef typename aux::weighted_tag<BOOST_MPL_AUX_MSVC_VALUE_WKND(order)::value>::type order_tag_;
114 typedef char (&order_tag_)[BOOST_MPL_AUX_MSVC_VALUE_WKND(order)::value];
117 BOOST_MPL_AUX_MAP_OVERLOAD( order_tag_, ORDER_BY_KEY, m_item_, aux::type_wrapper<Key>* );
120 template< typename Key, typename Base >
127 typedef typename prior< typename Base::size >::type size;
128 typedef typename x_order_impl<Base,Key>::type key_order_;
130 BOOST_MPL_AUX_MAP_OVERLOAD( aux::no_tag, ORDER_BY_KEY, m_mask, aux::type_wrapper<Key>* );
131 BOOST_MPL_AUX_MAP_OVERLOAD( aux::yes_tag, IS_MASKED, m_mask, key_order_* );
134 #endif // BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES
138 #endif // BOOST_MPL_MAP_AUX_ITEM_HPP_INCLUDED