> On 15 Sep 2018, at 22:56, Frank Heckenbach <f.heckenb...@fh-soft.de> wrote: > > You don't need h at all. > > Simply "b = std::move (a);" will do the same. All it does is convert > a to an rvalue reference. If A has a move assignment operator, this > will be chosen, if it doesn't but a copy assignment operator, that > one will be chosen. That's all standard C++ behaviour.
But you can't safely or in general have Bison writing $$ = std::move(a) directly as one might do something else to a afterwards. So a way to make it safe is to jump out of the action statement. Using functions and returns is probably not a good idea because one would have to capture variables in the action. > What I want (or actually have, since I imeplented it :) is a way to > make Bison apply std::move automatically. But that just applies it always, which might be safe for your move only type, but is not safe in general, right?