Chris@16
|
1
|
Chris@16
|
2 #ifndef BOOST_MPL_AUX_INSERTER_ALGORITHM_HPP_INCLUDED
|
Chris@16
|
3 #define BOOST_MPL_AUX_INSERTER_ALGORITHM_HPP_INCLUDED
|
Chris@16
|
4
|
Chris@16
|
5 // Copyright Aleksey Gurtovoy 2003-2004
|
Chris@16
|
6 // Copyright David Abrahams 2003-2004
|
Chris@16
|
7 //
|
Chris@16
|
8 // Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
9 // (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
10 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
11 //
|
Chris@16
|
12 // See http://www.boost.org/libs/mpl for documentation.
|
Chris@16
|
13
|
Chris@101
|
14 // $Id$
|
Chris@101
|
15 // $Date$
|
Chris@101
|
16 // $Revision$
|
Chris@16
|
17
|
Chris@16
|
18 #include <boost/mpl/back_inserter.hpp>
|
Chris@16
|
19 #include <boost/mpl/front_inserter.hpp>
|
Chris@16
|
20 #include <boost/mpl/push_back.hpp>
|
Chris@16
|
21 #include <boost/mpl/push_front.hpp>
|
Chris@16
|
22 #include <boost/mpl/back_inserter.hpp>
|
Chris@16
|
23 #include <boost/mpl/front_inserter.hpp>
|
Chris@16
|
24 #include <boost/mpl/clear.hpp>
|
Chris@16
|
25 #include <boost/mpl/eval_if.hpp>
|
Chris@16
|
26 #include <boost/mpl/if.hpp>
|
Chris@16
|
27 #include <boost/mpl/aux_/na.hpp>
|
Chris@16
|
28 #include <boost/mpl/aux_/common_name_wknd.hpp>
|
Chris@16
|
29 #include <boost/mpl/aux_/na_spec.hpp>
|
Chris@16
|
30 #include <boost/mpl/aux_/preprocessor/params.hpp>
|
Chris@16
|
31 #include <boost/mpl/aux_/preprocessor/default_params.hpp>
|
Chris@16
|
32 #include <boost/mpl/aux_/config/ctps.hpp>
|
Chris@16
|
33
|
Chris@16
|
34 #include <boost/preprocessor/arithmetic/dec.hpp>
|
Chris@16
|
35
|
Chris@16
|
36 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
Chris@16
|
37
|
Chris@16
|
38 # define BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(arity, name) \
|
Chris@16
|
39 BOOST_MPL_AUX_COMMON_NAME_WKND(name) \
|
Chris@16
|
40 template< \
|
Chris@16
|
41 BOOST_MPL_PP_DEFAULT_PARAMS(arity, typename P, na) \
|
Chris@16
|
42 > \
|
Chris@16
|
43 struct name \
|
Chris@16
|
44 : aux::name##_impl<BOOST_MPL_PP_PARAMS(arity, P)> \
|
Chris@16
|
45 { \
|
Chris@16
|
46 }; \
|
Chris@16
|
47 \
|
Chris@16
|
48 template< \
|
Chris@16
|
49 BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), typename P) \
|
Chris@16
|
50 > \
|
Chris@16
|
51 struct name< BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P),na > \
|
Chris@16
|
52 : if_< has_push_back< typename clear<P1>::type> \
|
Chris@16
|
53 , aux::name##_impl< \
|
Chris@16
|
54 BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
|
Chris@16
|
55 , back_inserter< typename clear<P1>::type > \
|
Chris@16
|
56 > \
|
Chris@16
|
57 , aux::reverse_##name##_impl< \
|
Chris@16
|
58 BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
|
Chris@16
|
59 , front_inserter< typename clear<P1>::type > \
|
Chris@16
|
60 > \
|
Chris@16
|
61 >::type \
|
Chris@16
|
62 { \
|
Chris@16
|
63 }; \
|
Chris@16
|
64 \
|
Chris@16
|
65 template< \
|
Chris@16
|
66 BOOST_MPL_PP_DEFAULT_PARAMS(arity, typename P, na) \
|
Chris@16
|
67 > \
|
Chris@16
|
68 struct reverse_##name \
|
Chris@16
|
69 : aux::reverse_##name##_impl<BOOST_MPL_PP_PARAMS(arity, P)> \
|
Chris@16
|
70 { \
|
Chris@16
|
71 }; \
|
Chris@16
|
72 \
|
Chris@16
|
73 template< \
|
Chris@16
|
74 BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), typename P) \
|
Chris@16
|
75 > \
|
Chris@16
|
76 struct reverse_##name< BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P),na > \
|
Chris@16
|
77 : if_< has_push_back<P1> \
|
Chris@16
|
78 , aux::reverse_##name##_impl< \
|
Chris@16
|
79 BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
|
Chris@16
|
80 , back_inserter< typename clear<P1>::type > \
|
Chris@16
|
81 > \
|
Chris@16
|
82 , aux::name##_impl< \
|
Chris@16
|
83 BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
|
Chris@16
|
84 , front_inserter< typename clear<P1>::type > \
|
Chris@16
|
85 > \
|
Chris@16
|
86 >::type \
|
Chris@16
|
87 { \
|
Chris@16
|
88 }; \
|
Chris@16
|
89 BOOST_MPL_AUX_NA_SPEC(arity, name) \
|
Chris@16
|
90 BOOST_MPL_AUX_NA_SPEC(arity, reverse_##name) \
|
Chris@16
|
91 /**/
|
Chris@16
|
92
|
Chris@16
|
93 #else
|
Chris@16
|
94
|
Chris@16
|
95 # define BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(arity, name) \
|
Chris@16
|
96 BOOST_MPL_AUX_COMMON_NAME_WKND(name) \
|
Chris@16
|
97 template< \
|
Chris@16
|
98 BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), typename P) \
|
Chris@16
|
99 > \
|
Chris@16
|
100 struct def_##name##_impl \
|
Chris@16
|
101 : if_< has_push_back<P1> \
|
Chris@16
|
102 , aux::name##_impl< \
|
Chris@16
|
103 BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
|
Chris@16
|
104 , back_inserter< typename clear<P1>::type > \
|
Chris@16
|
105 > \
|
Chris@16
|
106 , aux::reverse_##name##_impl< \
|
Chris@16
|
107 BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
|
Chris@16
|
108 , front_inserter< typename clear<P1>::type > \
|
Chris@16
|
109 > \
|
Chris@16
|
110 >::type \
|
Chris@16
|
111 { \
|
Chris@16
|
112 }; \
|
Chris@16
|
113 \
|
Chris@16
|
114 template< \
|
Chris@16
|
115 BOOST_MPL_PP_DEFAULT_PARAMS(arity, typename P, na) \
|
Chris@16
|
116 > \
|
Chris@16
|
117 struct name \
|
Chris@16
|
118 { \
|
Chris@16
|
119 typedef typename eval_if< \
|
Chris@16
|
120 is_na<BOOST_PP_CAT(P, arity)> \
|
Chris@16
|
121 , def_##name##_impl<BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P)> \
|
Chris@16
|
122 , aux::name##_impl<BOOST_MPL_PP_PARAMS(arity, P)> \
|
Chris@16
|
123 >::type type; \
|
Chris@16
|
124 }; \
|
Chris@16
|
125 \
|
Chris@16
|
126 template< \
|
Chris@16
|
127 BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), typename P) \
|
Chris@16
|
128 > \
|
Chris@16
|
129 struct def_reverse_##name##_impl \
|
Chris@16
|
130 : if_< has_push_back<P1> \
|
Chris@16
|
131 , aux::reverse_##name##_impl< \
|
Chris@16
|
132 BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
|
Chris@16
|
133 , back_inserter< typename clear<P1>::type > \
|
Chris@16
|
134 > \
|
Chris@16
|
135 , aux::name##_impl< \
|
Chris@16
|
136 BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
|
Chris@16
|
137 , front_inserter< typename clear<P1>::type > \
|
Chris@16
|
138 > \
|
Chris@16
|
139 >::type \
|
Chris@16
|
140 { \
|
Chris@16
|
141 }; \
|
Chris@16
|
142 template< \
|
Chris@16
|
143 BOOST_MPL_PP_DEFAULT_PARAMS(arity, typename P, na) \
|
Chris@16
|
144 > \
|
Chris@16
|
145 struct reverse_##name \
|
Chris@16
|
146 { \
|
Chris@16
|
147 typedef typename eval_if< \
|
Chris@16
|
148 is_na<BOOST_PP_CAT(P, arity)> \
|
Chris@16
|
149 , def_reverse_##name##_impl<BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P)> \
|
Chris@16
|
150 , aux::reverse_##name##_impl<BOOST_MPL_PP_PARAMS(arity, P)> \
|
Chris@16
|
151 >::type type; \
|
Chris@16
|
152 }; \
|
Chris@16
|
153 BOOST_MPL_AUX_NA_SPEC(arity, name) \
|
Chris@16
|
154 BOOST_MPL_AUX_NA_SPEC(arity, reverse_##name) \
|
Chris@16
|
155 /**/
|
Chris@16
|
156
|
Chris@16
|
157 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
Chris@16
|
158
|
Chris@16
|
159 #endif // BOOST_MPL_AUX_INSERTER_ALGORITHM_HPP_INCLUDED
|