From 1cc585cb360729c4a3d2b01b13e935648e893b3f Mon Sep 17 00:00:00 2001 From: Joel de Guzman Date: Tue, 8 Jun 2010 01:27:59 +0000 Subject: [PATCH] First shot by Thomas Heller [SVN r62536] --- include/boost/phoenix/core/actor.hpp | 62 ++++++++++++++++++--- include/boost/phoenix/core/actor_result.hpp | 21 +++++-- include/boost/phoenix/core/domain.hpp | 5 +- include/boost/phoenix/core/meta_grammar.hpp | 9 ++- placeholder.txt | 0 5 files changed, 84 insertions(+), 13 deletions(-) delete mode 100644 placeholder.txt diff --git a/include/boost/phoenix/core/actor.hpp b/include/boost/phoenix/core/actor.hpp index aaf7e4c..84749d8 100644 --- a/include/boost/phoenix/core/actor.hpp +++ b/include/boost/phoenix/core/actor.hpp @@ -8,8 +8,15 @@ #ifndef PHOENIX_CORE_ACTOR_HPP #define PHOENIX_CORE_ACTOR_HPP -#include +#include +#include +#include +#include +#include +#include +#include +#include namespace boost { namespace phoenix { //////////////////////////////////////////////////////////////////////////// @@ -17,29 +24,70 @@ namespace boost { namespace phoenix // This class is responsible for full function evaluation. Partial // function evaluation involves creating a hierarchy of actor objects. //////////////////////////////////////////////////////////////////////////// - template + template struct actor { BOOST_PROTO_BASIC_EXTENDS(Expr, actor, phoenix_domain) BOOST_PROTO_EXTENDS_ASSIGN() BOOST_PROTO_EXTENDS_SUBSCRIPT() - template + template struct result : actor_result {}; typedef actor actor_type; - template - typename boost::result_of::type + struct dummy {}; + + //typename boost::result_of::type + //typename actor_result::type + //typename boost::result_of&)>::type + void + operator()() const + { + BOOST_PROTO_ASSERT_MATCHES( *this, eval_grammar ); + fusion::vector0<> args; + + eval(*this, args); + //return eval(*this, args); + } + + template + //typename boost::result_of::type + typename actor_result::type + //typename boost::result_of&)>::type operator()(A0 const& a0) const { BOOST_PROTO_ASSERT_MATCHES(*this, eval_grammar); - fusion::vector args(a0); + fusion::vector1 args(a0); + + return eval(*this, args); + } + + template + //typename boost::result_of::type + typename actor_result::type + //typename boost::result_of&)>::type + operator()(A0 const& a0, A1 const& a1) const + { + BOOST_PROTO_ASSERT_MATCHES(*this, eval_grammar); + fusion::vector2 args(a0, a1); + + std::cout << typeid( eval( *this, args ) ).name() << "\n"; + return eval(*this, args); } /*... more...*/ }; -}} +} + + template + struct result_of() > + { + typedef phoenix::actor F; + typedef typename F::template result::type type; + }; + +} #endif diff --git a/include/boost/phoenix/core/actor_result.hpp b/include/boost/phoenix/core/actor_result.hpp index 19161b5..ff26fff 100644 --- a/include/boost/phoenix/core/actor_result.hpp +++ b/include/boost/phoenix/core/actor_result.hpp @@ -9,19 +9,32 @@ #define PHOENIX_CORE_ACTOR_RESULT_HPP #include -#include +#include +#include + +#include namespace boost { namespace phoenix { //////////////////////////////////////////////////////////////////////////// // Return type computation //////////////////////////////////////////////////////////////////////////// - template + template struct actor_result; - template