Chris@16: Chris@16: #ifndef BOOST_MPL_AUX_INSERTER_ALGORITHM_HPP_INCLUDED Chris@16: #define BOOST_MPL_AUX_INSERTER_ALGORITHM_HPP_INCLUDED Chris@16: Chris@16: // Copyright Aleksey Gurtovoy 2003-2004 Chris@16: // Copyright David Abrahams 2003-2004 Chris@16: // Chris@16: // Distributed under the Boost Software License, Version 1.0. Chris@16: // (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: // Chris@16: // See http://www.boost.org/libs/mpl for documentation. Chris@16: Chris@101: // $Id$ Chris@101: // $Date$ Chris@101: // $Revision$ Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) Chris@16: Chris@16: # define BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(arity, name) \ Chris@16: BOOST_MPL_AUX_COMMON_NAME_WKND(name) \ Chris@16: template< \ Chris@16: BOOST_MPL_PP_DEFAULT_PARAMS(arity, typename P, na) \ Chris@16: > \ Chris@16: struct name \ Chris@16: : aux::name##_impl \ Chris@16: { \ Chris@16: }; \ Chris@16: \ Chris@16: template< \ Chris@16: BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), typename P) \ Chris@16: > \ Chris@16: struct name< BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P),na > \ Chris@16: : if_< has_push_back< typename clear::type> \ Chris@16: , aux::name##_impl< \ Chris@16: BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \ Chris@16: , back_inserter< typename clear::type > \ Chris@16: > \ Chris@16: , aux::reverse_##name##_impl< \ Chris@16: BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \ Chris@16: , front_inserter< typename clear::type > \ Chris@16: > \ Chris@16: >::type \ Chris@16: { \ Chris@16: }; \ Chris@16: \ Chris@16: template< \ Chris@16: BOOST_MPL_PP_DEFAULT_PARAMS(arity, typename P, na) \ Chris@16: > \ Chris@16: struct reverse_##name \ Chris@16: : aux::reverse_##name##_impl \ Chris@16: { \ Chris@16: }; \ Chris@16: \ Chris@16: template< \ Chris@16: BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), typename P) \ Chris@16: > \ Chris@16: struct reverse_##name< BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P),na > \ Chris@16: : if_< has_push_back \ Chris@16: , aux::reverse_##name##_impl< \ Chris@16: BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \ Chris@16: , back_inserter< typename clear::type > \ Chris@16: > \ Chris@16: , aux::name##_impl< \ Chris@16: BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \ Chris@16: , front_inserter< typename clear::type > \ Chris@16: > \ Chris@16: >::type \ Chris@16: { \ Chris@16: }; \ Chris@16: BOOST_MPL_AUX_NA_SPEC(arity, name) \ Chris@16: BOOST_MPL_AUX_NA_SPEC(arity, reverse_##name) \ Chris@16: /**/ Chris@16: Chris@16: #else Chris@16: Chris@16: # define BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(arity, name) \ Chris@16: BOOST_MPL_AUX_COMMON_NAME_WKND(name) \ Chris@16: template< \ Chris@16: BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), typename P) \ Chris@16: > \ Chris@16: struct def_##name##_impl \ Chris@16: : if_< has_push_back \ Chris@16: , aux::name##_impl< \ Chris@16: BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \ Chris@16: , back_inserter< typename clear::type > \ Chris@16: > \ Chris@16: , aux::reverse_##name##_impl< \ Chris@16: BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \ Chris@16: , front_inserter< typename clear::type > \ Chris@16: > \ Chris@16: >::type \ Chris@16: { \ Chris@16: }; \ Chris@16: \ Chris@16: template< \ Chris@16: BOOST_MPL_PP_DEFAULT_PARAMS(arity, typename P, na) \ Chris@16: > \ Chris@16: struct name \ Chris@16: { \ Chris@16: typedef typename eval_if< \ Chris@16: is_na \ Chris@16: , def_##name##_impl \ Chris@16: , aux::name##_impl \ Chris@16: >::type type; \ Chris@16: }; \ Chris@16: \ Chris@16: template< \ Chris@16: BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), typename P) \ Chris@16: > \ Chris@16: struct def_reverse_##name##_impl \ Chris@16: : if_< has_push_back \ Chris@16: , aux::reverse_##name##_impl< \ Chris@16: BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \ Chris@16: , back_inserter< typename clear::type > \ Chris@16: > \ Chris@16: , aux::name##_impl< \ Chris@16: BOOST_MPL_PP_PARAMS(BOOST_PP_DEC(arity), P) \ Chris@16: , front_inserter< typename clear::type > \ Chris@16: > \ Chris@16: >::type \ Chris@16: { \ Chris@16: }; \ Chris@16: template< \ Chris@16: BOOST_MPL_PP_DEFAULT_PARAMS(arity, typename P, na) \ Chris@16: > \ Chris@16: struct reverse_##name \ Chris@16: { \ Chris@16: typedef typename eval_if< \ Chris@16: is_na \ Chris@16: , def_reverse_##name##_impl \ Chris@16: , aux::reverse_##name##_impl \ Chris@16: >::type type; \ Chris@16: }; \ Chris@16: BOOST_MPL_AUX_NA_SPEC(arity, name) \ Chris@16: BOOST_MPL_AUX_NA_SPEC(arity, reverse_##name) \ Chris@16: /**/ Chris@16: Chris@16: #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION Chris@16: Chris@16: #endif // BOOST_MPL_AUX_INSERTER_ALGORITHM_HPP_INCLUDED