From db113a8c48ca828814a565a815537c4d2dd263ca Mon Sep 17 00:00:00 2001 From: Thomas Heller Date: Thu, 5 May 2011 19:23:27 +0000 Subject: [PATCH] [phoenix] fixed some limits and scope [SVN r71745] --- include/boost/phoenix/core/limits.hpp | 20 +++++------ include/boost/phoenix/scope/let.hpp | 7 +++- include/boost/phoenix/scope/this.hpp | 36 +++++++++++-------- .../boost/phoenix/stl/algorithm/querying.hpp | 1 + 4 files changed, 38 insertions(+), 26 deletions(-) diff --git a/include/boost/phoenix/core/limits.hpp b/include/boost/phoenix/core/limits.hpp index f6b08f8..b1879df 100644 --- a/include/boost/phoenix/core/limits.hpp +++ b/include/boost/phoenix/core/limits.hpp @@ -96,12 +96,12 @@ #if !defined(BOOST_PROTO_MAX_ARITY) # define BOOST_PROTO_MAX_ARITY BOOST_PP_INC(BOOST_PHOENIX_COMPOSITE_LIMIT) -# if defined(BOOST_MPL_LIMIT_METAFUNCTION_ARITY) -# undef BOOST_MPL_LIMIT_METAFUNCTION_ARITY -# endif -# define BOOST_MPL_LIMIT_METAFUNCTION_ARITY BOOST_PP_INC(BOOST_PROTO_MAX_ARITY) +# if !defined(BOOST_MPL_LIMIT_METAFUNCTION_ARITY) +# define BOOST_MPL_LIMIT_METAFUNCTION_ARITY BOOST_PP_INC(BOOST_PROTO_MAX_ARITY) //# define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS -//# endif +# elif BOOST_MPL_LIMIT_METAFUNCTION_ARITY < BOOST_PROTO_MAX_ARITY +# error "BOOST_MPL_LIMIT_METAFUNCTION_ARITY < BOOST_PROTO_MAX_ARITY" +# endif #elif (BOOST_PROTO_MAX_ARITY < BOOST_PHOENIX_COMPOSE_LIMIT) # error "BOOST_PROTO_MAX_ARITY < BOOST_PHOENIX_COMPOSITE_LIMIT" #endif @@ -112,11 +112,11 @@ # error "BOOST_PROTO_MAX_LOGICAL_ARITY < BOOST_PHOENIX_COMPOSITE_LIMIT" #endif -#if !defined(BOOST_RESULT_OF_NUM_ARGS) -# define BOOST_RESULT_OF_NUM_ARGS BOOST_PP_INC(BOOST_PHOENIX_COMPOSITE_LIMIT) -#elif BOOST_RESULT_OF_NUM_ARGS < BOOST_PP_INC(BOOST_PHOENIX_COMPOSITE_LIMIT) -# error "BOOST_RESULT_OF_NUM_ARGS < BOOST_PHOENIX_COMPOSITE_LIMIT + 1" -#endif +//#if !defined(BOOST_RESULT_OF_NUM_ARGS) +//# define BOOST_RESULT_OF_NUM_ARGS BOOST_PP_INC(BOOST_PHOENIX_COMPOSITE_LIMIT) +//#elif BOOST_RESULT_OF_NUM_ARGS < BOOST_PP_INC(BOOST_PHOENIX_COMPOSITE_LIMIT) +//# error "BOOST_RESULT_OF_NUM_ARGS < BOOST_PHOENIX_COMPOSITE_LIMIT + 1" +//#endif // this include will set the limit for the proto expression arity #include diff --git a/include/boost/phoenix/scope/let.hpp b/include/boost/phoenix/scope/let.hpp index 435b0a1..739c0f8 100644 --- a/include/boost/phoenix/scope/let.hpp +++ b/include/boost/phoenix/scope/let.hpp @@ -33,7 +33,12 @@ namespace boost { namespace phoenix struct result; template - struct result + struct result + : result + {}; + + template + struct result { typedef typename result_of::actions::type diff --git a/include/boost/phoenix/scope/this.hpp b/include/boost/phoenix/scope/this.hpp index aedf5b2..9d3e1f3 100644 --- a/include/boost/phoenix/scope/this.hpp +++ b/include/boost/phoenix/scope/this.hpp @@ -14,24 +14,28 @@ #include #include #include +#include #include +/* BOOST_PHOENIX_DEFINE_EXPRESSION_VARARG( (boost)(phoenix)(this_function) , (meta_grammar)(meta_grammar) , BOOST_PHOENIX_LIMIT ) +*/ namespace boost { namespace phoenix { - + /* template struct this_actor; + */ namespace detail { template struct this_placeholder {}; - + /* struct infinite_recursion_detected {}; struct last_non_this_actor @@ -55,8 +59,9 @@ namespace boost { namespace phoenix { > > {}; + */ } - +#if 0 struct this_function_eval { BOOST_PROTO_CALLABLE() @@ -72,6 +77,8 @@ namespace boost { namespace phoenix { template struct result { + typedef void type; + /* typedef typename evaluator::impl::result_type this_type; @@ -87,6 +94,7 @@ namespace boost { namespace phoenix { typename boost::result_of::type(arg0_type)>::type >::type type; + */ }; template @@ -97,6 +105,8 @@ namespace boost { namespace phoenix { template struct result { + typedef void type; + /* typedef typename evaluator::impl::result_type this_type; @@ -116,15 +126,16 @@ namespace boost { namespace phoenix { typename boost::result_of::type(arg0_type, arg1_type)>::type >::type type; + */ }; template typename result::type - operator()(This const& _this, T0 const & t0, Context & ctx) const + operator()(This const& _this, T0 const & t0, Context const & ctx) const { - typedef typename evaluator::impl::result_type this_type; - typedef typename detail::last_non_this_actor::impl::result_type checker; + //typedef typename evaluator::impl::result_type this_type; + //typedef typename detail::last_non_this_actor::impl::result_type checker; //std::cout << typeid(checker).name() << "\n"; //std::cout << typeid(checker).name() << "\n"; @@ -134,14 +145,9 @@ namespace boost { namespace phoenix { template typename result::type - operator()(This const& _this, T0 const & t0, T1 const & t1, Context & ctx) const + operator()(This const& this_, T0 const & t0, T1 const & t1, Context const & ctx) const { - typedef typename evaluator::impl::result_type this_type; - typedef typename detail::last_non_this_actor::impl::result_type checker; - - //std::cout << typeid(checker).name() << "\n"; - - return boost::phoenix::eval(_this, ctx)(boost::phoenix::eval(t0, ctx), boost::phoenix::eval(t1, ctx)); + return boost::phoenix::eval(this_, ctx)(boost::phoenix::eval(t0, ctx), boost::phoenix::eval(t1, ctx)); } }; @@ -183,7 +189,7 @@ namespace boost { namespace phoenix { return expression::this_function::make(*this, t0, t1); } }; - +#endif template struct is_custom_terminal > @@ -230,7 +236,7 @@ namespace boost { namespace phoenix { : proto::terminal > { typedef proto::terminal >::type base_type; - typedef this_actor type; + typedef actor type; static const type make() { diff --git a/include/boost/phoenix/stl/algorithm/querying.hpp b/include/boost/phoenix/stl/algorithm/querying.hpp index 1825a03..08c3089 100644 --- a/include/boost/phoenix/stl/algorithm/querying.hpp +++ b/include/boost/phoenix/stl/algorithm/querying.hpp @@ -14,6 +14,7 @@ #include +#include #include #include #include