|
Proto : |
Subject: Re: [proto] Recent (rvalue support) changes in proto causes a whole bunch of regressions in Spirit
From: Eric Niebler (eric_at_[hidden])
Date: 2011-10-10 00:38:07
On 10/9/2011 8:32 PM, Joel de Guzman wrote:
> Hi,
>
> This code:
>
> #include <boost/spirit/include/qi.hpp>
>
> int main()
> {
> namespace qi = boost::spirit::qi;
>
> qi::rule<char const*> r;
> r %= (+qi::char_);
>
> return 0;
> }
>
> no longer works as expected. r %= (+qi::char_) becomes a no-op.
> Before it calls either:
>
> template <typename Expr>
> friend rule& operator%=(rule& r, Expr const& expr);
>
> // non-const version needed to suppress proto's %= kicking in
> template <typename Expr>
> friend rule& operator%=(rule& r, Expr& expr);
>
> Both defined in the rule class.
>
> Correct me if I'm wrong, but it seems the changes in proto forces
> us to support rvalue refs, but we are not ready for that yet and
> it's too late in the release cycle.
>
> Thoughts?
Bummer. I suggest adding an rvalue ref overload of operator%= that
shares an implementation with the const lvalue one. Should just be a few
lines of code. Is that a problem?
As an alternative, you can use a domain/grammar to disable Proto's
operator%= for Spirit rules.
-- Eric Niebler BoostPro Computing http://www.boostpro.com
Proto list run by eric at boostpro.com