Boost logo

Boost :

Subject: Re: [boost] [spirit.lex] 9580
From: Vyacheslav Andrejev (mortituris_at_[hidden])
Date: 2014-01-30 10:15:35


HK>> The first has an rvalue as its left hand side operand, while the
HK>> second one uses an lvalue there.
HK>>
VA> How does it explain that neither of
VA> boost::spirit::lex::detail::operator += gets called?

Now I understand what is going on. An rvalue cannot be bound to a non-const
reference. boost::spirit::lex::detail::operator+= has a non-const reference
as the first parameter and this->self("SOME_STATE") returns an rvalue. Therefore
the compiler doesn't call boost::spirit::lex::detail::operator+=, but uses
template <typename Left, typename Right> operator +=(Left &&left, Right &&right)
from boost::proto::expns_ instead.

--
-- Vyacheslav Andrejev

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk