source: NonGTP/Boost/boost/mpl/map/aux_/item.hpp @ 857

Revision 857, 4.0 KB checked in by igarcia, 19 years ago (diff)
Line 
1
2#ifndef BOOST_MPL_MAP_AUX_ITEM_HPP_INCLUDED
3#define BOOST_MPL_MAP_AUX_ITEM_HPP_INCLUDED
4
5// Copyright Aleksey Gurtovoy 2003-2004
6// Copyright David Abrahams 2003-2004
7//
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)
11//
12// See http://www.boost.org/libs/mpl for documentation.
13
14// $Source: /cvsroot/boost/boost/boost/mpl/map/aux_/item.hpp,v $
15// $Date: 2004/12/14 14:05:32 $
16// $Revision: 1.5 $
17
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>
30
31
32namespace boost { namespace mpl {
33
34#if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES)
35
36template< typename Key, typename T, typename Base >
37struct m_item
38    : Base
39{
40    typedef Key         key_;
41    typedef pair<Key,T> item;
42    typedef Base        base;
43   
44    typedef typename next< typename Base::size >::type  size;
45    typedef typename next< typename Base::order >::type order;
46
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_;
49#else
50    typedef char (&order_tag_)[BOOST_MPL_AUX_MSVC_VALUE_WKND(order)::value];
51#endif
52
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>* );
56};
57
58
59template< typename Key, typename Base >
60struct m_mask
61    : Base
62{
63    typedef void_   key_;
64    typedef Base    base;
65
66    typedef typename prior< typename Base::size >::type  size;
67    typedef typename x_order_impl<Base,Key>::type key_order_;
68   
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_* );
71};
72
73#else // BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES
74
75
76#   if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
77
78template< long n, typename Key, typename T, typename Base >
79struct m_item;
80
81#   else
82
83template< long n >
84struct m_item_impl
85{
86    template< typename Key, typename T, typename Base >
87    struct result_;
88};
89
90template< long n, typename Key, typename T, typename Base >
91struct m_item
92    : m_item_impl<n>::result_<Key,T,Base>
93{
94};
95
96
97#   endif
98
99
100template< typename Key, typename T, typename Base >
101struct m_item_
102    : Base
103{
104    typedef Key     key_;
105    typedef Base    base;
106    typedef m_item_ type;
107   
108    typedef typename next< typename Base::size >::type  size;
109    typedef typename next< typename Base::order >::type order;
110
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_;
113#else
114    typedef char (&order_tag_)[BOOST_MPL_AUX_MSVC_VALUE_WKND(order)::value];
115#endif
116
117    BOOST_MPL_AUX_MAP_OVERLOAD( order_tag_, ORDER_BY_KEY, m_item_, aux::type_wrapper<Key>* );
118};
119
120template< typename Key, typename Base >
121struct m_mask
122    : Base
123{
124    typedef void_   key_;
125    typedef Base    base;
126
127    typedef typename prior< typename Base::size >::type  size;
128    typedef typename x_order_impl<Base,Key>::type key_order_;
129   
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_* );
132};
133
134#endif // BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES
135
136}}
137
138#endif // BOOST_MPL_MAP_AUX_ITEM_HPP_INCLUDED
Note: See TracBrowser for help on using the repository browser.