Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:41:38

0001 
0002 #ifndef BOOST_MPL_AUX_INSERTER_ALGORITHM_HPP_INCLUDED
0003 #define BOOST_MPL_AUX_INSERTER_ALGORITHM_HPP_INCLUDED
0004 
0005 // Copyright Aleksey Gurtovoy 2003-2004
0006 // Copyright David Abrahams 2003-2004
0007 //
0008 // Distributed under the Boost Software License, Version 1.0. 
0009 // (See accompanying file LICENSE_1_0.txt or copy at 
0010 // http://www.boost.org/LICENSE_1_0.txt)
0011 //
0012 // See http://www.boost.org/libs/mpl for documentation.
0013 
0014 // $Id$
0015 // $Date$
0016 // $Revision$
0017 
0018 #include <boost/mpl/back_inserter.hpp>
0019 #include <boost/mpl/front_inserter.hpp>
0020 #include <boost/mpl/push_back.hpp>
0021 #include <boost/mpl/push_front.hpp>
0022 #include <boost/mpl/back_inserter.hpp>
0023 #include <boost/mpl/front_inserter.hpp>
0024 #include <boost/mpl/clear.hpp>
0025 #include <boost/mpl/eval_if.hpp>
0026 #include <boost/mpl/if.hpp>
0027 #include <boost/mpl/aux_/na.hpp>
0028 #include <boost/mpl/aux_/common_name_wknd.hpp>
0029 #include <boost/mpl/aux_/na_spec.hpp>
0030 #include <boost/mpl/aux_/preprocessor/params.hpp>
0031 #include <boost/mpl/aux_/preprocessor/default_params.hpp>
0032 #include <boost/mpl/aux_/config/ctps.hpp>
0033 
0034 #include <boost/preprocessor/arithmetic/dec.hpp>
0035 
0036 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
0037 
0038 #   define BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(arity, name) \
0039 BOOST_MPL_AUX_COMMON_NAME_WKND(name) \
0040 template< \
0041       BOOST_MPL_PP_DEFAULT_PARAMS(arity, typename P, na) \
0042     > \
0043 struct name \
0044     : aux::name##_impl<BOOST_MPL_PP_PARAMS(arity, P)> \
0045 { \
0046 }; \
0047 \
0048 template< \
0049       BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), typename P) \
0050     > \
0051 struct name< BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P),na > \
0052     : if_< has_push_back< typename clear<P1>::type> \
0053         , aux::name##_impl< \
0054               BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
0055             , back_inserter< typename clear<P1>::type > \
0056             > \
0057         , aux::reverse_##name##_impl< \
0058               BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
0059             , front_inserter< typename clear<P1>::type > \
0060             > \
0061         >::type \
0062 { \
0063 }; \
0064 \
0065 template< \
0066       BOOST_MPL_PP_DEFAULT_PARAMS(arity, typename P, na) \
0067     > \
0068 struct reverse_##name \
0069     : aux::reverse_##name##_impl<BOOST_MPL_PP_PARAMS(arity, P)> \
0070 { \
0071 }; \
0072 \
0073 template< \
0074       BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), typename P) \
0075     > \
0076 struct reverse_##name< BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P),na > \
0077     : if_< has_push_back<P1> \
0078         , aux::reverse_##name##_impl< \
0079               BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
0080             , back_inserter< typename clear<P1>::type > \
0081             > \
0082         , aux::name##_impl< \
0083               BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
0084             , front_inserter< typename clear<P1>::type > \
0085             > \
0086         >::type \
0087 { \
0088 }; \
0089 BOOST_MPL_AUX_NA_SPEC(arity, name) \
0090 BOOST_MPL_AUX_NA_SPEC(arity, reverse_##name) \
0091 /**/
0092 
0093 #else
0094 
0095 #   define BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(arity, name) \
0096 BOOST_MPL_AUX_COMMON_NAME_WKND(name) \
0097 template< \
0098       BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), typename P) \
0099     > \
0100 struct def_##name##_impl \
0101     : if_< has_push_back<P1> \
0102         , aux::name##_impl< \
0103               BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
0104             , back_inserter< typename clear<P1>::type > \
0105             > \
0106         , aux::reverse_##name##_impl< \
0107               BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
0108             , front_inserter< typename clear<P1>::type > \
0109             > \
0110         >::type \
0111 { \
0112 }; \
0113 \
0114 template< \
0115       BOOST_MPL_PP_DEFAULT_PARAMS(arity, typename P, na) \
0116     > \
0117 struct name \
0118 { \
0119     typedef typename eval_if< \
0120           is_na<BOOST_PP_CAT(P, arity)> \
0121         , def_##name##_impl<BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P)> \
0122         , aux::name##_impl<BOOST_MPL_PP_PARAMS(arity, P)> \
0123         >::type type; \
0124 }; \
0125 \
0126 template< \
0127       BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), typename P) \
0128     > \
0129 struct def_reverse_##name##_impl \
0130     : if_< has_push_back<P1> \
0131         , aux::reverse_##name##_impl< \
0132               BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
0133             , back_inserter< typename clear<P1>::type > \
0134             > \
0135         , aux::name##_impl< \
0136               BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \
0137             , front_inserter< typename clear<P1>::type > \
0138             > \
0139         >::type \
0140 { \
0141 }; \
0142 template< \
0143       BOOST_MPL_PP_DEFAULT_PARAMS(arity, typename P, na) \
0144     > \
0145 struct reverse_##name \
0146 { \
0147     typedef typename eval_if< \
0148           is_na<BOOST_PP_CAT(P, arity)> \
0149         , def_reverse_##name##_impl<BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P)> \
0150         , aux::reverse_##name##_impl<BOOST_MPL_PP_PARAMS(arity, P)> \
0151         >::type type; \
0152 }; \
0153 BOOST_MPL_AUX_NA_SPEC(arity, name) \
0154 BOOST_MPL_AUX_NA_SPEC(arity, reverse_##name) \
0155 /**/
0156 
0157 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
0158 
0159 #endif // BOOST_MPL_AUX_INSERTER_ALGORITHM_HPP_INCLUDED