diff --git a/include/boost/python/detail/member_function_cast.hpp b/include/boost/python/detail/member_function_cast.hpp index 5ac2caa3..18af9700 100644 --- a/include/boost/python/detail/member_function_cast.hpp +++ b/include/boost/python/detail/member_function_cast.hpp @@ -7,6 +7,10 @@ # define MEMBER_FUNCTION_CAST_DWA2002311_HPP # include # include +# include +# include +# include +# include namespace boost { namespace python { namespace detail { @@ -49,175 +53,26 @@ struct member_function_cast_impl { return non_member_function_cast_impl(); } -# endif - template - static cast_helper stage1(R (S::*)()) - { - return cast_helper(); - } +# endif + +// Member functions +# ifndef BOOST_PYTHON_GENERATE_CODE +# include +# endif - template - static cast_helper stage1(R (S::*)(A0)) - { - return cast_helper(); - } +# define BOOST_PYTHON_MEMBER_FUNCTION_CAST_STAGE1(args, cv) \ +template < \ + class S \ + , class R \ + BOOST_PP_COMMA_IF(BOOST_PP_DEC(args)) BOOST_MPL_TEMPLATE_PARAMETERS(1, args, class A) \ + > \ +static cast_helper \ +stage1(BOOST_PYTHON_FN(S::*,1,args)cv()) \ +{ \ + return cast_helper(); \ +} - template - static cast_helper stage1(R (S::*)(A0,A1)) - { - return cast_helper(); - } - - template - static cast_helper stage1(R (S::*)(A0,A1,A2)) - { - return cast_helper(); - } - - template - static cast_helper stage1(R (S::*)(A0,A1,A2,A3)) - { - return cast_helper(); - } - - template - static cast_helper stage1(R (S::*)(A0,A1,A2,A3,A4)) - { - return cast_helper(); - } - - - template - static cast_helper stage1(R (S::*)(A0,A1,A2,A3,A4,A5)) - { - return cast_helper(); - } - - template - static cast_helper stage1(R (S::*)()const) - { - return cast_helper(); - } - - template - static cast_helper stage1(R (S::*)(A0)const) - { - return cast_helper(); - } - - template - static cast_helper stage1(R (S::*)(A0,A1)const) - { - return cast_helper(); - } - - template - static cast_helper stage1(R (S::*)(A0,A1,A2)const) - { - return cast_helper(); - } - - template - static cast_helper stage1(R (S::*)(A0,A1,A2,A3)const) - { - return cast_helper(); - } - - template - static cast_helper stage1(R (S::*)(A0,A1,A2,A3,A4)const) - { - return cast_helper(); - } - - template - static cast_helper stage1(R (S::*)(A0,A1,A2,A3,A4,A5)const) - { - return cast_helper(); - } - - template - static cast_helper stage1(R (S::*)()volatile) - { - return cast_helper(); - } - - template - static cast_helper stage1(R (S::*)(A0)volatile) - { - return cast_helper(); - } - - template - static cast_helper stage1(R (S::*)(A0,A1)volatile) - { - return cast_helper(); - } - - template - static cast_helper stage1(R (S::*)(A0,A1,A2)volatile) - { - return cast_helper(); - } - - template - static cast_helper stage1(R (S::*)(A0,A1,A2,A3)volatile) - { - return cast_helper(); - } - - template - static cast_helper stage1(R (S::*)(A0,A1,A2,A3,A4)volatile) - { - return cast_helper(); - } - - template - static cast_helper stage1(R (S::*)(A0,A1,A2,A3,A4,A5)volatile) - { - return cast_helper(); - } - - template - static cast_helper stage1(R (S::*)()const volatile) - { - return cast_helper(); - } - - template - static cast_helper stage1(R (S::*)(A0)const volatile) - { - return cast_helper(); - } - - template - static cast_helper stage1(R (S::*)(A0,A1)const volatile) - { - return cast_helper(); - } - - template - static cast_helper stage1(R (S::*)(A0,A1,A2)const volatile) - { - return cast_helper(); - } - - template - static cast_helper stage1(R (S::*)(A0,A1,A2,A3)const volatile) - { - return cast_helper(); - } - - template - static cast_helper stage1(R (S::*)(A0,A1,A2,A3,A4)const volatile) - { - return cast_helper(); - } - - template - static cast_helper stage1(R (S::*)(A0,A1,A2,A3,A4,A5)const volatile) - { - return cast_helper(); - } +BOOST_PYTHON_REPEAT_MF_ALL_CV_2ND(BOOST_PYTHON_MEMBER_FUNCTION_CAST_STAGE1); }; diff --git a/include/boost/python/detail/preprocessor.hpp b/include/boost/python/detail/preprocessor.hpp index 2773140e..23278436 100644 --- a/include/boost/python/detail/preprocessor.hpp +++ b/include/boost/python/detail/preprocessor.hpp @@ -61,17 +61,8 @@ namespace boost { namespace python { namespace detail { # define BOOST_PYTHON_MF_ARITY_FINISH BOOST_PP_INC(BOOST_PYTHON_MAX_ARITY) #endif -# define BOOST_PYTHON_NAMED_PF(f,Count) \ - R(*f)(BOOST_MPL_TEMPLATE_PARAMETERS(0,Count,A)) - -# define BOOST_PYTHON_NAMED_PMF(f, Count, cv) \ - R(A0::*f)(BOOST_MPL_TEMPLATE_PARAMETERS(1,Count,A))cv() - -# define BOOST_PYTHON_PF(Count) \ - R(*)(BOOST_MPL_TEMPLATE_PARAMETERS(0,Count,A)) - -# define BOOST_PYTHON_PMF(Count, cv) \ - R(A0::*)(BOOST_MPL_TEMPLATE_PARAMETERS(1,Count,A))cv() +# define BOOST_PYTHON_FN(inner,start,count) \ + R(inner)(BOOST_MPL_TEMPLATE_PARAMETERS(start,count,A)) # define BOOST_PYTHON_REPEAT_ARITY_2ND(function,data) \ BOOST_PP_REPEAT_FROM_TO_2ND( \ diff --git a/include/boost/python/preprocessed/member_Function_cast.hpp b/include/boost/python/preprocessed/member_Function_cast.hpp new file mode 100644 index 00000000..691b16f5 --- /dev/null +++ b/include/boost/python/preprocessed/member_Function_cast.hpp @@ -0,0 +1,250 @@ +// Copyright David Abrahams 2002. Permission to copy, use, +// modify, sell and distribute this software is granted provided this +// copyright notice appears in all copies. This software is provided +// "as is" without express or implied warranty, and with no claim as +// to its suitability for any purpose. +#ifndef MEMBER_FUNCTION_CAST_DWA2002410_HPP +# define MEMBER_FUNCTION_CAST_DWA2002410_HPP + +template +static cast_helper +stage1(R(S::*)()) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1)) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2)) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2,A3)) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2,A3,A4)) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2,A3,A4,A5)) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2,A3,A4,A5,A6)) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2,A3,A4,A5,A6,A7)) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2,A3,A4,A5,A6,A7,A8)) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2,A3,A4,A5,A6,A7,A8,A9)) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)()const) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1)const) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2)const) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2,A3)const) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2,A3,A4)const) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2,A3,A4,A5)const) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2,A3,A4,A5,A6)const) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2,A3,A4,A5,A6,A7)const) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2,A3,A4,A5,A6,A7,A8)const) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2,A3,A4,A5,A6,A7,A8,A9)const) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)()volatile) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1)volatile) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2)volatile) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2,A3)volatile) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2,A3,A4)volatile) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2,A3,A4,A5)volatile) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2,A3,A4,A5,A6)volatile) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2,A3,A4,A5,A6,A7)volatile) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2,A3,A4,A5,A6,A7,A8)volatile) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2,A3,A4,A5,A6,A7,A8,A9)volatile) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)()const volatile) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1)const volatile) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2)const volatile) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2,A3)const volatile) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2,A3,A4)const volatile) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2,A3,A4,A5)const volatile) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2,A3,A4,A5,A6)const volatile) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2,A3,A4,A5,A6,A7)const volatile) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2,A3,A4,A5,A6,A7,A8)const volatile) +{ + return cast_helper(); +} +template +static cast_helper +stage1(R(S::*)(A1,A2,A3,A4,A5,A6,A7,A8,A9)const volatile) +{ + return cast_helper(); +} + +#endif // MEMBER_FUNCTION_CAST_DWA2002410_HPP