diff --git a/include/boost/mpl/aux_/preprocessor/def_params_tail.hpp b/include/boost/mpl/aux_/preprocessor/def_params_tail.hpp index 0ef5da4..c8e564c 100644 --- a/include/boost/mpl/aux_/preprocessor/def_params_tail.hpp +++ b/include/boost/mpl/aux_/preprocessor/def_params_tail.hpp @@ -21,6 +21,8 @@ #include "boost/mpl/aux_/config/dtp.hpp" #include "boost/mpl/aux_/config/preprocessor.hpp" +#include "boost/preprocessor/comma_if.hpp" +#include "boost/preprocessor/logical/and.hpp" #include "boost/preprocessor/identity.hpp" #include "boost/preprocessor/empty.hpp" @@ -47,9 +49,11 @@ /**/ # define BOOST_MPL_PP_DEF_PARAMS_TAIL_DELAY_2(i, n, param, value_func) \ - , BOOST_MPL_PP_DEF_PARAMS_TAIL_##i(n,param,value_func) \ + BOOST_PP_COMMA_IF(BOOST_PP_AND(i,n)) \ + BOOST_MPL_PP_DEF_PARAMS_TAIL_##i(n,param,value_func) \ /**/ +# define BOOST_MPL_PP_DEF_PARAMS_TAIL_0(i,p,v) BOOST_MPL_PP_FILTER_PARAMS_##i(p##1 v(),p##2 v(),p##3 v(),p##4 v(),p##5 v(),p##6 v(),p##7 v(),p##8 v(),p##9 v()) # define BOOST_MPL_PP_DEF_PARAMS_TAIL_1(i,p,v) BOOST_MPL_PP_FILTER_PARAMS_##i(p##2 v(),p##3 v(),p##4 v(),p##5 v(),p##6 v(),p##7 v(),p##8 v(),p##9 v(),p1) # define BOOST_MPL_PP_DEF_PARAMS_TAIL_2(i,p,v) BOOST_MPL_PP_FILTER_PARAMS_##i(p##3 v(),p##4 v(),p##5 v(),p##6 v(),p##7 v(),p##8 v(),p##9 v(),p1,p2) # define BOOST_MPL_PP_DEF_PARAMS_TAIL_3(i,p,v) BOOST_MPL_PP_FILTER_PARAMS_##i(p##4 v(),p##5 v(),p##6 v(),p##7 v(),p##8 v(),p##9 v(),p1,p2,p3) @@ -70,7 +74,8 @@ # include "boost/preprocessor/cat.hpp" # define BOOST_MPL_PP_AUX_TAIL_PARAM_FUNC(unused, i, op) \ - , BOOST_PP_CAT( \ + BOOST_PP_COMMA_IF(i) \ + BOOST_PP_CAT( \ BOOST_PP_TUPLE_ELEM(3, 1, op) \ , BOOST_PP_ADD_D(1, i, BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(3, 0, op))) \ ) BOOST_PP_TUPLE_ELEM(3, 2, op)() \ diff --git a/include/boost/mpl/aux_/preprocessor/partial_spec_params.hpp b/include/boost/mpl/aux_/preprocessor/partial_spec_params.hpp new file mode 100644 index 0000000..75db7a0 --- /dev/null +++ b/include/boost/mpl/aux_/preprocessor/partial_spec_params.hpp @@ -0,0 +1,35 @@ +//----------------------------------------------------------------------------- +// boost mpl/aux_/preprocessor/partial_spec_params.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2000-02 +// Aleksey Gurtovoy +// +// Permission to use, copy, modify, distribute and sell this software +// and its documentation for any purpose is hereby granted without fee, +// provided that the above copyright notice appears in all copies and +// that both the copyright notice and this permission notice appear in +// supporting documentation. No representations are made about the +// suitability of this software for any purpose. It is provided "as is" +// without express or implied warranty. + +#ifndef BOOST_MPL_AUX_PREPROCESSOR_PARTIAL_SPEC_PARAMS_HPP_INCLUDED +#define BOOST_MPL_AUX_PREPROCESSOR_PARTIAL_SPEC_PARAMS_HPP_INCLUDED + +#include "boost/mpl/limits/arity.hpp" +#include "boost/mpl/aux_/preprocessor/params.hpp" +#include "boost/mpl/aux_/preprocessor/enum.hpp" +#include "boost/mpl/aux_/preprocessor/sub.hpp" +#include "boost/preprocessor/comma_if.hpp" + +#define BOOST_MPL_PP_PARTIAL_SPEC_PARAMS(n, param, def) \ +BOOST_MPL_PP_PARAMS(n, param) \ +BOOST_PP_COMMA_IF(BOOST_MPL_PP_SUB(BOOST_MPL_METAFUNCTION_MAX_ARITY,n)) \ +BOOST_MPL_PP_ENUM( \ + BOOST_MPL_PP_SUB(BOOST_MPL_METAFUNCTION_MAX_ARITY,n) \ + , def \ + ) \ +/**/ + +#endif // BOOST_MPL_AUX_PREPROCESSOR_PARTIAL_SPEC_PARAMS_HPP_INCLUDED