From 916b4d2c2f9cf5fa5d74da4a23eb244303dd9c7e Mon Sep 17 00:00:00 2001 From: Daniel Wallin Date: Fri, 29 Sep 2006 00:31:28 +0000 Subject: [PATCH] merged HEAD to RC [SVN r35405] --- include/boost/parameter/aux_/cast.hpp | 22 +++++++++++++++++++ .../boost/parameter/aux_/python/invoker.hpp | 4 ++-- include/boost/parameter/preprocessor.hpp | 15 +++++++------ test/preprocessor.cpp | 10 ++++++--- test/python_test.cpp | 14 +++++++++++- 5 files changed, 52 insertions(+), 13 deletions(-) diff --git a/include/boost/parameter/aux_/cast.hpp b/include/boost/parameter/aux_/cast.hpp index 8604722..5c55b66 100755 --- a/include/boost/parameter/aux_/cast.hpp +++ b/include/boost/parameter/aux_/cast.hpp @@ -13,6 +13,8 @@ namespace boost { namespace parameter { namespace aux { +struct use_default_tag {}; + # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) @@ -42,6 +44,16 @@ struct cast; template <> struct cast { + static use_default_tag execute(use_default_tag) + { + return use_default_tag(); + } + + static use_default_tag remove_const(use_default_tag) + { + return use_default_tag(); + } + template static U& execute(U& value) { @@ -82,6 +94,16 @@ struct cast typename boost::remove_const::type >::type reference; + static use_default_tag execute(use_default_tag) + { + return use_default_tag(); + } + + static use_default_tag remove_const(use_default_tag) + { + return use_default_tag(); + } + static T execute(T value) { return value; diff --git a/include/boost/parameter/aux_/python/invoker.hpp b/include/boost/parameter/aux_/python/invoker.hpp index d90ad7d..57a585f 100755 --- a/include/boost/parameter/aux_/python/invoker.hpp +++ b/include/boost/parameter/aux_/python/invoker.hpp @@ -85,9 +85,9 @@ struct invoker<0, M, R, Args> template struct member_invoker<0, M, R, T, Args> { - static R execute() + static R execute(T& self) { - return M()(boost::type()); + return M()(boost::type(), self); } }; diff --git a/include/boost/parameter/preprocessor.hpp b/include/boost/parameter/preprocessor.hpp index eaa5251..6398b01 100755 --- a/include/boost/parameter/preprocessor.hpp +++ b/include/boost/parameter/preprocessor.hpp @@ -219,8 +219,6 @@ struct funptr_predicate # endif -struct use_default_tag {}; - }}} // namespace boost::parameter::aux # if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) @@ -690,11 +688,14 @@ struct use_default_tag {}; >::get() | boost::parameter::aux::use_default_tag() # define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_GET_ARG(arg, tag_ns) \ - args[ \ - BOOST_PARAMETER_FUNCTION_DEFAULT_EVAL_DEFAULT( \ - arg, tag_ns \ - ) \ - ] \ + BOOST_PARAMETER_FUNCTION_CAST( \ + args[ \ + BOOST_PARAMETER_FUNCTION_DEFAULT_EVAL_DEFAULT( \ + arg, tag_ns \ + ) \ + ] \ + , BOOST_PARAMETER_FN_ARG_PRED(arg) \ + ) # define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_BODY(name, n, split_args, tag_namespace) \ { \ diff --git a/test/preprocessor.cpp b/test/preprocessor.cpp index 4f6315b..ae44e4f 100755 --- a/test/preprocessor.cpp +++ b/test/preprocessor.cpp @@ -77,7 +77,10 @@ BOOST_PARAMETER_FUNCTION((int), h, tag, ) ) { - BOOST_MPL_ASSERT((boost::is_same)); +# if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) \ + && !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + BOOST_MPL_ASSERT((boost::is_same)); +# endif tester( name @@ -99,8 +102,9 @@ BOOST_PARAMETER_FUNCTION((int), h2, tag, ) ) { -# if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) - BOOST_MPL_ASSERT((boost::is_same)); +# if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) \ + && !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + BOOST_MPL_ASSERT((boost::is_same)); # endif tester( diff --git a/test/python_test.cpp b/test/python_test.cpp index ca60ad6..1cb74b9 100755 --- a/test/python_test.cpp +++ b/test/python_test.cpp @@ -98,6 +98,18 @@ struct g_fwd struct h_fwd { + template + R operator()(boost::type, T& self) + { + return self.h(); + } + + template + R operator()(boost::type, T& self, A0 const& a0) + { + return self.h(a0); + } + template R operator()(boost::type, T& self, A0 const& a0, A1 const& a1) { @@ -142,7 +154,7 @@ BOOST_PYTHON_MODULE(python_test_ext) , boost::parameter::python::function< h_fwd , mpl::vector< - X&, tag::x*(std::string), tag::y*(std::string) + X&, tag::x**(std::string), tag::y**(std::string) > >() , return_arg<>()