Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74892 - trunk/boost/spirit/home/lex/lexer
From: hartmut.kaiser_at_[hidden]
Date: 2011-10-10 08:10:05


Author: hkaiser
Date: 2011-10-10 08:10:05 EDT (Mon, 10 Oct 2011)
New Revision: 74892
URL: http://svn.boost.org/trac/boost/changeset/74892

Log:
Spirit: adding rvalue reference overload for lexer::operator+=(), fixes regressions caused by recent proto changes
Text files modified:
   trunk/boost/spirit/home/lex/lexer/lexer.hpp | 17 +++++++++++++++++
   1 files changed, 17 insertions(+), 0 deletions(-)

Modified: trunk/boost/spirit/home/lex/lexer/lexer.hpp
==============================================================================
--- trunk/boost/spirit/home/lex/lexer/lexer.hpp (original)
+++ trunk/boost/spirit/home/lex/lexer/lexer.hpp 2011-10-10 08:10:05 EDT (Mon, 10 Oct 2011)
@@ -285,6 +285,7 @@
             lexer_def_& operator= (lexer_def_ const&);
         };
 
+#if defined(BOOST_NO_RVALUE_REFERENCES)
         // allow to assign a token definition expression
         template <typename LexerDef, typename Expr>
         inline lexer_def_<LexerDef>&
@@ -299,6 +300,22 @@
             lexdef.define(xpr);
             return lexdef;
         }
+#else
+ // allow to assign a token definition expression
+ template <typename LexerDef, typename Expr>
+ inline lexer_def_<LexerDef>&
+ operator+= (lexer_def_<LexerDef>& lexdef, Expr&& xpr)
+ {
+ // Report invalid expression error as early as possible.
+ // If you got an error_invalid_expression error message here,
+ // then the expression (expr) is not a valid spirit lex
+ // expression.
+ BOOST_SPIRIT_ASSERT_MATCH(lex::domain, Expr);
+
+ lexdef.define(xpr);
+ return lexdef;
+ }
+#endif
 
         template <typename LexerDef, typename Expr>
         inline lexer_def_<LexerDef>&


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk