2 #ifndef BOOST_MPL_AUX_INSERTER_ALGORITHM_HPP_INCLUDED
\r
3 #define BOOST_MPL_AUX_INSERTER_ALGORITHM_HPP_INCLUDED
\r
5 // Copyright Aleksey Gurtovoy 2003-2004
\r
6 // Copyright David Abrahams 2003-2004
\r
8 // Distributed under the Boost Software License, Version 1.0.
\r
9 // (See accompanying file LICENSE_1_0.txt or copy at
\r
10 // http://www.boost.org/LICENSE_1_0.txt)
\r
12 // See http://www.boost.org/libs/mpl for documentation.
\r
14 // $Id: inserter_algorithm.hpp 55648 2009-08-18 05:16:53Z agurtovoy $
\r
15 // $Date: 2009-08-18 01:16:53 -0400 (Tue, 18 Aug 2009) $
\r
16 // $Revision: 55648 $
\r
18 #include <boost/mpl/back_inserter.hpp>
\r
19 #include <boost/mpl/front_inserter.hpp>
\r
20 #include <boost/mpl/push_back.hpp>
\r
21 #include <boost/mpl/push_front.hpp>
\r
22 #include <boost/mpl/back_inserter.hpp>
\r
23 #include <boost/mpl/front_inserter.hpp>
\r
24 #include <boost/mpl/clear.hpp>
\r
25 #include <boost/mpl/eval_if.hpp>
\r
26 #include <boost/mpl/if.hpp>
\r
27 #include <boost/mpl/aux_/na.hpp>
\r
28 #include <boost/mpl/aux_/common_name_wknd.hpp>
\r
29 #include <boost/mpl/aux_/na_spec.hpp>
\r
30 #include <boost/mpl/aux_/preprocessor/params.hpp>
\r
31 #include <boost/mpl/aux_/preprocessor/default_params.hpp>
\r
32 #include <boost/mpl/aux_/config/ctps.hpp>
\r
34 #include <boost/preprocessor/arithmetic/dec.hpp>
\r
36 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
\r
38 # define BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(arity, name) \
\r
39 BOOST_MPL_AUX_COMMON_NAME_WKND(name) \
\r
41 BOOST_MPL_PP_DEFAULT_PARAMS(arity, typename P, na) \
\r
44 : aux::name##_impl<BOOST_MPL_PP_PARAMS(arity, P)> \
\r
49 BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), typename P) \
\r
51 struct name< BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P),na > \
\r
52 : if_< has_push_back< typename clear<P1>::type> \
\r
53 , aux::name##_impl< \
\r
54 BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
\r
55 , back_inserter< typename clear<P1>::type > \
\r
57 , aux::reverse_##name##_impl< \
\r
58 BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
\r
59 , front_inserter< typename clear<P1>::type > \
\r
66 BOOST_MPL_PP_DEFAULT_PARAMS(arity, typename P, na) \
\r
68 struct reverse_##name \
\r
69 : aux::reverse_##name##_impl<BOOST_MPL_PP_PARAMS(arity, P)> \
\r
74 BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), typename P) \
\r
76 struct reverse_##name< BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P),na > \
\r
77 : if_< has_push_back<P1> \
\r
78 , aux::reverse_##name##_impl< \
\r
79 BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
\r
80 , back_inserter< typename clear<P1>::type > \
\r
82 , aux::name##_impl< \
\r
83 BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
\r
84 , front_inserter< typename clear<P1>::type > \
\r
89 BOOST_MPL_AUX_NA_SPEC(arity, name) \
\r
90 BOOST_MPL_AUX_NA_SPEC(arity, reverse_##name) \
\r
95 # define BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(arity, name) \
\r
96 BOOST_MPL_AUX_COMMON_NAME_WKND(name) \
\r
98 BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), typename P) \
\r
100 struct def_##name##_impl \
\r
101 : if_< has_push_back<P1> \
\r
102 , aux::name##_impl< \
\r
103 BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
\r
104 , back_inserter< typename clear<P1>::type > \
\r
106 , aux::reverse_##name##_impl< \
\r
107 BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
\r
108 , front_inserter< typename clear<P1>::type > \
\r
115 BOOST_MPL_PP_DEFAULT_PARAMS(arity, typename P, na) \
\r
119 typedef typename eval_if< \
\r
120 is_na<BOOST_PP_CAT(P, arity)> \
\r
121 , def_##name##_impl<BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P)> \
\r
122 , aux::name##_impl<BOOST_MPL_PP_PARAMS(arity, P)> \
\r
127 BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), typename P) \
\r
129 struct def_reverse_##name##_impl \
\r
130 : if_< has_push_back<P1> \
\r
131 , aux::reverse_##name##_impl< \
\r
132 BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
\r
133 , back_inserter< typename clear<P1>::type > \
\r
135 , aux::name##_impl< \
\r
136 BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
\r
137 , front_inserter< typename clear<P1>::type > \
\r
143 BOOST_MPL_PP_DEFAULT_PARAMS(arity, typename P, na) \
\r
145 struct reverse_##name \
\r
147 typedef typename eval_if< \
\r
148 is_na<BOOST_PP_CAT(P, arity)> \
\r
149 , def_reverse_##name##_impl<BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P)> \
\r
150 , aux::reverse_##name##_impl<BOOST_MPL_PP_PARAMS(arity, P)> \
\r
153 BOOST_MPL_AUX_NA_SPEC(arity, name) \
\r
154 BOOST_MPL_AUX_NA_SPEC(arity, reverse_##name) \
\r
157 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
\r
159 #endif // BOOST_MPL_AUX_INSERTER_ALGORITHM_HPP_INCLUDED
\r