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

Revision 857, 2.6 KB checked in by igarcia, 19 years ago (diff)
Line 
1
2// NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION
3
4#if !defined(BOOST_PP_IS_ITERATING)
5
6// Copyright Aleksey Gurtovoy 2000-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_/numbered.hpp,v $
15// $Date: 2004/12/14 14:05:32 $
16// $Revision: 1.4 $
17
18#else
19
20#include <boost/mpl/aux_/config/typeof.hpp>
21#include <boost/mpl/aux_/config/ctps.hpp>
22#include <boost/preprocessor/enum_params.hpp>
23#include <boost/preprocessor/dec.hpp>
24#include <boost/preprocessor/cat.hpp>
25
26#define i_ BOOST_PP_FRAME_ITERATION(1)
27
28#   define AUX778076_MAP_TAIL(map, i_, P) \
29    BOOST_PP_CAT(map,i_)< \
30          BOOST_PP_ENUM_PARAMS(i_, P) \
31        > \
32    /**/
33
34
35#if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES)
36
37template<
38      BOOST_PP_ENUM_PARAMS(i_, typename P)
39    >
40struct BOOST_PP_CAT(map,i_)
41    : m_item<
42          typename BOOST_PP_CAT(P,BOOST_PP_DEC(i_))::first
43        , typename BOOST_PP_CAT(P,BOOST_PP_DEC(i_))::second
44        , AUX778076_MAP_TAIL(map,BOOST_PP_DEC(i_),P)
45        >
46{
47    typedef BOOST_PP_CAT(map,i_) type;
48};
49
50#else // "brute force" implementation
51
52#   if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
53
54template< typename Map>
55struct m_at<Map,BOOST_PP_DEC(i_)>
56{
57    typedef typename Map::BOOST_PP_CAT(item,BOOST_PP_DEC(i_)) type;
58};
59
60template< typename Key, typename T, typename Base >
61struct m_item<i_,Key,T,Base>
62    : m_item_<Key,T,Base>
63{
64    typedef pair<Key,T> BOOST_PP_CAT(item,BOOST_PP_DEC(i_));
65};
66
67#   else
68
69template<>
70struct m_at_impl<BOOST_PP_DEC(i_)>
71{
72    template< typename Map > struct result_
73    {
74        typedef typename Map::BOOST_PP_CAT(item,BOOST_PP_DEC(i_)) type;
75    };
76};
77
78template<>
79struct m_item_impl<i_>
80{
81    template< typename Key, typename T, typename Base > struct result_
82        : m_item_<Key,T,Base>
83    {
84        typedef pair<Key,T> BOOST_PP_CAT(item,BOOST_PP_DEC(i_));
85    };
86};
87
88#   endif
89
90template<
91      BOOST_PP_ENUM_PARAMS(i_, typename P)
92    >
93struct BOOST_PP_CAT(map,i_)
94    : m_item<
95          i_
96        , typename BOOST_PP_CAT(P,BOOST_PP_DEC(i_))::first
97        , typename BOOST_PP_CAT(P,BOOST_PP_DEC(i_))::second
98        , AUX778076_MAP_TAIL(map,BOOST_PP_DEC(i_),P)
99        >
100{
101    typedef BOOST_PP_CAT(map,i_) type;
102};
103
104#endif // BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES
105
106#   undef AUX778076_MAP_TAIL
107
108#undef i_
109
110#endif // BOOST_PP_IS_ITERATING
Note: See TracBrowser for help on using the repository browser.