From c847fc2b0c91ef8b3dee7b9d6d23a9e985712239 Mon Sep 17 00:00:00 2001 From: Daniel Wallin Date: Fri, 26 May 2006 10:52:56 +0000 Subject: [PATCH] new Parameter.Python syntax [SVN r34093] --- include/boost/parameter/python.hpp | 60 +++++++++++++++++------------- 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/include/boost/parameter/python.hpp b/include/boost/parameter/python.hpp index 65dd48b..3da7740 100755 --- a/include/boost/parameter/python.hpp +++ b/include/boost/parameter/python.hpp @@ -27,6 +27,7 @@ # include # include # include +# include namespace boost { namespace parameter { namespace python { @@ -505,8 +506,15 @@ namespace aux template struct keyword - : keyword - {}; + { + typedef K type; + }; + + template + struct keyword + { + typedef K type; + }; template struct required @@ -531,37 +539,39 @@ namespace aux { typedef mpl::false_ type; }; - + + template + struct make_kw_spec; + template - struct make_kw_spec + struct make_kw_spec { typedef arg_spec< typename keyword::type , typename required::type , typename optimized::type , T - > type; + > type; }; } // namespace aux -template +template struct init - : boost::python::def_visitor > + : boost::python::def_visitor > { template void visit(Class& cl) const { typedef typename mpl::transform< - Keywords - , Signature - , aux::make_kw_spec + Signature + , aux::make_kw_spec , mpl::back_inserter > >::type arg_specs; typedef typename mpl::count_if< arg_specs - , aux::is_optional + , aux::is_optional >::type optional_arity; typedef typename mpl::shift_left, optional_arity>::type upper; @@ -576,9 +586,9 @@ struct init } }; -template +template struct call - : boost::python::def_visitor > + : boost::python::def_visitor > { template void visit(Class& cl) const @@ -590,19 +600,19 @@ struct call , typename mpl::end::type > arg_types; + typedef typename mpl::front::type result_type; + typedef typename mpl::transform< - Keywords - , arg_types - , aux::make_kw_spec + arg_types + , aux::make_kw_spec , mpl::back_inserter > >::type arg_specs; typedef typename mpl::count_if< arg_specs - , aux::is_optional + , aux::is_optional >::type optional_arity; - typedef typename mpl::front::type result_type; typedef typename mpl::shift_left, optional_arity>::type upper; aux::def_combinations( @@ -615,9 +625,9 @@ struct call } }; -template +template struct function - : boost::python::def_visitor > + : boost::python::def_visitor > { template void visit(Class& cl, char const* name, Options const& options) const @@ -629,19 +639,19 @@ struct function , typename mpl::end::type > arg_types; + typedef typename mpl::front::type result_type; + typedef typename mpl::transform< - Keywords - , arg_types - , aux::make_kw_spec + arg_types + , aux::make_kw_spec , mpl::back_inserter > >::type arg_specs; typedef typename mpl::count_if< arg_specs - , aux::is_optional + , aux::is_optional >::type optional_arity; - typedef typename mpl::front::type result_type; typedef typename mpl::shift_left, optional_arity>::type upper; aux::def_combinations(