Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:41:43

0001 
0002 #ifndef BOOST_MPL_MAP_AUX_ITEM_HPP_INCLUDED
0003 #define BOOST_MPL_MAP_AUX_ITEM_HPP_INCLUDED
0004 
0005 // Copyright Aleksey Gurtovoy 2003-2004
0006 // Copyright David Abrahams 2003-2004
0007 //
0008 // Distributed under the Boost Software License, Version 1.0. 
0009 // (See accompanying file LICENSE_1_0.txt or copy at 
0010 // http://www.boost.org/LICENSE_1_0.txt)
0011 //
0012 // See http://www.boost.org/libs/mpl for documentation.
0013 
0014 // $Id$
0015 // $Date$
0016 // $Revision$
0017 
0018 #include <boost/mpl/void.hpp>
0019 #include <boost/mpl/pair.hpp>
0020 #include <boost/mpl/long.hpp>
0021 #include <boost/mpl/next.hpp>
0022 #include <boost/mpl/prior.hpp>
0023 #include <boost/mpl/map/aux_/map0.hpp>
0024 #include <boost/mpl/aux_/order_impl.hpp>
0025 #include <boost/mpl/aux_/yes_no.hpp>
0026 #include <boost/mpl/aux_/type_wrapper.hpp>
0027 #include <boost/mpl/aux_/config/arrays.hpp>
0028 #include <boost/mpl/aux_/config/typeof.hpp>
0029 #include <boost/mpl/aux_/config/ctps.hpp>
0030 
0031 
0032 namespace boost { namespace mpl {
0033 
0034 #if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES)
0035 
0036 template< typename Key, typename T, typename Base >
0037 struct m_item
0038     : Base
0039 {
0040     typedef Key         key_;
0041     typedef pair<Key,T> item;
0042     typedef Base        base;
0043     typedef m_item      type;
0044     
0045     typedef typename next< typename Base::size >::type  size;
0046     typedef typename next< typename Base::order >::type order;
0047 
0048 #if defined(BOOST_MPL_CFG_NO_DEPENDENT_ARRAY_TYPES)
0049     typedef typename aux::weighted_tag<BOOST_MPL_AUX_MSVC_VALUE_WKND(order)::value>::type order_tag_;
0050 #else
0051     typedef char (&order_tag_)[BOOST_MPL_AUX_MSVC_VALUE_WKND(order)::value];
0052 #endif
0053 
0054     BOOST_MPL_AUX_MAP_OVERLOAD( aux::type_wrapper<T>, VALUE_BY_KEY, m_item, aux::type_wrapper<Key>* );
0055     BOOST_MPL_AUX_MAP_OVERLOAD( aux::type_wrapper<item>, ITEM_BY_ORDER, m_item, order* );
0056     BOOST_MPL_AUX_MAP_OVERLOAD( order_tag_, ORDER_BY_KEY, m_item, aux::type_wrapper<Key>* );
0057 };
0058 
0059 
0060 template< typename Key, typename Base >
0061 struct m_mask
0062     : Base
0063 {
0064     typedef void_   key_;
0065     typedef Base    base;
0066     typedef m_mask  type;
0067 
0068     typedef typename prior< typename Base::size >::type  size;
0069     typedef typename x_order_impl<Base,Key>::type key_order_;
0070     
0071     BOOST_MPL_AUX_MAP_OVERLOAD( aux::type_wrapper<void_>, VALUE_BY_KEY, m_mask, aux::type_wrapper<Key>* );
0072     BOOST_MPL_AUX_MAP_OVERLOAD( aux::type_wrapper<void_>, ITEM_BY_ORDER, m_mask, key_order_* );
0073 };
0074 
0075 #else // BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES
0076 
0077 
0078 #   if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
0079 
0080 template< long n, typename Key, typename T, typename Base >
0081 struct m_item;
0082 
0083 #   else
0084 
0085 template< long n >
0086 struct m_item_impl
0087 {
0088     template< typename Key, typename T, typename Base >
0089     struct result_;
0090 };
0091 
0092 template< long n, typename Key, typename T, typename Base >
0093 struct m_item
0094     : m_item_impl<n>::result_<Key,T,Base>
0095 {
0096 };
0097 
0098 
0099 #   endif
0100 
0101 
0102 template< typename Key, typename T, typename Base >
0103 struct m_item_
0104     : Base
0105 {
0106     typedef Key     key_;
0107     typedef Base    base;
0108     typedef m_item_ type;
0109     
0110     typedef typename next< typename Base::size >::type  size;
0111     typedef typename next< typename Base::order >::type order;
0112 
0113 #if defined(BOOST_MPL_CFG_NO_DEPENDENT_ARRAY_TYPES)
0114     typedef typename aux::weighted_tag<BOOST_MPL_AUX_MSVC_VALUE_WKND(order)::value>::type order_tag_;
0115 #else
0116     typedef char (&order_tag_)[BOOST_MPL_AUX_MSVC_VALUE_WKND(order)::value];
0117 #endif
0118 
0119     BOOST_MPL_AUX_MAP_OVERLOAD( order_tag_, ORDER_BY_KEY, m_item_, aux::type_wrapper<Key>* );
0120 };
0121 
0122 template< typename Key, typename Base >
0123 struct m_mask
0124     : Base
0125 {
0126     typedef void_   key_;
0127     typedef Base    base;
0128     typedef m_mask  type;
0129 
0130     typedef typename prior< typename Base::size >::type  size;
0131     typedef typename x_order_impl<Base,Key>::type key_order_;
0132     
0133     BOOST_MPL_AUX_MAP_OVERLOAD( aux::no_tag, ORDER_BY_KEY, m_mask, aux::type_wrapper<Key>* );
0134     BOOST_MPL_AUX_MAP_OVERLOAD( aux::yes_tag, IS_MASKED, m_mask, key_order_* );
0135 };
0136 
0137 #endif // BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES
0138 
0139 }}
0140 
0141 #endif // BOOST_MPL_MAP_AUX_ITEM_HPP_INCLUDED