bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Automatially move from $n (was: C++11 move semantics)


From: Hans Åberg
Subject: Re: Automatially move from $n (was: C++11 move semantics)
Date: Sat, 15 Sep 2018 23:20:29 +0200

> On 15 Sep 2018, at 22:56, Frank Heckenbach <address@hidden> 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?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]