[Top][All Lists]

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

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

From: Frank Heckenbach
Subject: Re: Automatially move from $n (was: C++11 move semantics)
Date: Sat, 15 Sep 2018 23:26:03 +0200

Hans Åberg wrote:

> But you can't safely or in general have Bison writing $$ =
> std::move(a) directly as one might do something else to a
> afterwards.

It would be safe if Bison checked that it's used only once in the

> So a way to make it safe is to jump out of the action statement.

Not necessarily: You could use it twice within one expression
(unsafe even with jump) or just not use it twice (safe even without

> > 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,

In fact it's safe for copy-only types, and possibly unsafe precisely
for movable types (move-only or move-and-copyable).

> but is not safe in general, right?

Right, that't why I made it opt-in by setting api.rhs.access.


reply via email to

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