Re: [Boost-bugs] [Boost C++ Libraries] #4425: qi::action ignores phoenix actor return value

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4425: qi::action ignores phoenix actor return value
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-07-14 06:10:11


#4425: qi::action ignores phoenix actor return value
-------------------------------+--------------------------------------------
  Reporter: anonymous | Owner: djowel
      Type: Feature Requests | Status: new
 Milestone: Boost 1.44.0 | Component: spirit
   Version: Boost 1.44.0 | Severity: Optimization
Resolution: | Keywords:
-------------------------------+--------------------------------------------

Comment (by anonymous):

 Hello again,

 I've added a step in action_dispatch that checks the return type of
 phoenix actors: If it is a boolean, the return value is &&ed with the pass
 argument value. Here is the function:

 template <typename Eval, typename Attribute, typename Context>
 bool operator()(
   phoenix::actor<Eval> const& f, Attribute& attr, Context& context)
 {
         bool pass = true;
         typename pass_attribute<Component, Attribute>::type
 attr_wrap(attr);

         typedef typename remove_reference<
                 typename Eval::template result<
                         phoenix::basic_environment<
                                 typename
 remove_reference<Attribute>::type,
                                 typename remove_reference<Context>::type,
                                 typename remove_reference<bool>::type>
>::type >::type
         return_type;

         return_type* ret = 0;

         return call(f, attr_wrap, context, pass, ret);
 }

 template<typename Eval, typename Attribute, typename Context, typename
 Return>
 inline bool call(
   phoenix::actor<Eval> const& f, Attribute& attr, Context& context, bool&
 pass, Return)
 const
 {
         f(attr, context, pass);
         return pass;
 }

 template<typename Eval, typename Attribute, typename Context>
 inline bool call(
   phoenix::actor<Eval> const& f, Attribute& attr, Context& context, bool&
 pass, bool*)
 const
 {
         bool ret = f(attr, context, pass);
         return pass = pass && ret;
 }

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4425#comment:1>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:03 UTC