Imported Upstream version 1.57.0
[platform/upstream/boost.git] / boost / fusion / container / generation / detail / pp_map_tie.hpp
1 /*=============================================================================
2     Copyright (c) 2001-2011 Joel de Guzman
3     Copyright (c) 2006 Dan Marsden
4
5     Distributed under the Boost Software License, Version 1.0. (See accompanying
6     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 ==============================================================================*/
8 #ifndef BOOST_PP_IS_ITERATING
9 #if !defined(FUSION_PP_MAP_TIE_20060814_1116)
10 #define FUSION_PP_MAP_TIE_20060814_1116
11
12 #include <boost/preprocessor/iterate.hpp>
13 #include <boost/preprocessor/repetition/enum_params.hpp>
14 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
15 #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
16 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
17 #include <boost/fusion/container/map/map.hpp>
18 #include <boost/fusion/container/map/detail/cpp03/limits.hpp>
19 #include <boost/fusion/support/pair.hpp>
20 #include <boost/fusion/container/generation/pair_tie.hpp>
21 #include <boost/type_traits/add_reference.hpp>
22
23 #if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
24 #include <boost/fusion/container/generation/detail/preprocessed/map_tie.hpp>
25 #else
26 #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
27 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/map_tie" FUSION_MAX_MAP_SIZE_STR".hpp")
28 #endif
29
30 /*=============================================================================
31     Copyright (c) 2001-2011 Joel de Guzman
32
33     Distributed under the Boost Software License, Version 1.0. (See accompanying
34     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
35
36     This is an auto-generated file. Do not edit!
37 ==============================================================================*/
38
39 #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
40 #pragma wave option(preserve: 1)
41 #endif
42
43 namespace boost { namespace fusion
44 {
45     struct void_;
46
47     namespace result_of
48     {
49         template <
50             BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
51                 FUSION_MAX_MAP_SIZE, typename K, void_)
52           , BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
53                 FUSION_MAX_MAP_SIZE, typename D, void_)
54           , typename Extra = void_
55         >
56         struct map_tie;
57
58         template <>
59         struct map_tie<>
60         {
61             typedef map<> type;
62         };
63     }
64
65     BOOST_FUSION_GPU_ENABLED inline map<>
66     map_tie()
67     {
68         return map<>();
69     }
70
71 #define BOOST_FUSION_TIED_PAIR(z, n, data)                                                          \
72     fusion::pair<                                                                                   \
73         BOOST_PP_CAT(K, n)                                                                          \
74       , typename add_reference<BOOST_PP_CAT(D, n)>::type>
75
76 #define BOOST_FUSION_PAIR_TIE(z, n, data)                                      \
77     fusion::pair_tie<BOOST_PP_CAT(K, n)>(BOOST_PP_CAT(_, n))                   \
78
79 #define BOOST_PP_FILENAME_1 <boost/fusion/container/generation/detail/pp_map_tie.hpp>
80 #define BOOST_PP_ITERATION_LIMITS (1, FUSION_MAX_MAP_SIZE)
81 #include BOOST_PP_ITERATE()
82
83 #undef BOOST_FUSION_PAIR
84 #undef BOOST_FUSION_MAKE_PAIR
85
86 }}
87
88 #if defined(__WAVE__) && defined(BOOST_FUSION_CREATE_PREPROCESSED_FILES)
89 #pragma wave option(output: null)
90 #endif
91
92 #endif // BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
93
94 #endif
95 #else // defined(BOOST_PP_IS_ITERATING)
96 ///////////////////////////////////////////////////////////////////////////////
97 //
98 //  Preprocessor vertical repetition code
99 //
100 ///////////////////////////////////////////////////////////////////////////////
101
102 #define N BOOST_PP_ITERATION()
103
104     namespace result_of
105     {
106         template <
107             BOOST_PP_ENUM_PARAMS(N, typename K)
108           , BOOST_PP_ENUM_PARAMS(N, typename D)
109         >
110         #define TEXT(z, n, text) , text
111         struct map_tie<BOOST_PP_ENUM_PARAMS(N, K), BOOST_PP_ENUM_PARAMS(N, D) BOOST_PP_REPEAT_FROM_TO(N, FUSION_MAX_MAP_SIZE, TEXT, void_) BOOST_PP_REPEAT_FROM_TO(BOOST_PP_DEC(N), FUSION_MAX_MAP_SIZE, TEXT, void_)>
112         #undef TEXT
113         {
114             typedef map<BOOST_PP_ENUM(N, BOOST_FUSION_TIED_PAIR, _)> type;
115         };
116     }
117
118     template <
119         BOOST_PP_ENUM_PARAMS(N, typename K)
120       , BOOST_PP_ENUM_PARAMS(N, typename D)
121     >
122     BOOST_FUSION_GPU_ENABLED
123     inline map<BOOST_PP_ENUM(N, BOOST_FUSION_TIED_PAIR, _)>
124     map_tie(BOOST_PP_ENUM_BINARY_PARAMS(N, D, & _))
125     {
126         return map<BOOST_PP_ENUM(N, BOOST_FUSION_TIED_PAIR, _)>(
127             BOOST_PP_ENUM(N, BOOST_FUSION_PAIR_TIE, _));
128     }
129
130 #undef N
131 #endif // defined(BOOST_PP_IS_ITERATING)
132