> Le 18 janv. 2015 à 23:28, Hans Aberg <haber...@telia.com> a écrit : > > C++11/C++14 seems to work really well with the compiler I am using (Apple > Clang on OS 10.10.2): perhaps there might be support for that in the C++ > parser, so that $$ = x o demand translates into $$ = std::move(x). - The > calc++ example has lines using std::swap($$, $k), but it would be a bit more > efficient with $$ = std::move($k) for heavier types than the copy-over type > ‘int’ used.
Hi Hans, I will stick to C++98 in the generated parsers. Yet, I agree, it would be nice to find the spots in the generated code where, using some #if checks, std::move could be used. FWIW, I extensively use Bison C++ parser with variants in a C++14 project. I works well. And I do use std::move in my actions. But Bison cannot use std::move in the actions: it can't tell the use of $n as an lvalue or as an rvalue. Maybe playing with std::forward could work, yet I think it is really up to the user to qualify her $n as she wants. $n is really a variable, and it's up to the user to decide how to use it.