[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
action.
> 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
jump).
> > 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.
Regards,
Frank
- Re: Automatially move from $n (was: C++11 move semantics), (continued)
- Re: Automatially move from $n (was: C++11 move semantics), Frank Heckenbach, 2018/09/15
- Re: Automatially move from $n (was: C++11 move semantics), Hans Åberg, 2018/09/15
- Re: Automatially move from $n (was: C++11 move semantics), Frank Heckenbach, 2018/09/15
- Re: Automatially move from $n (was: C++11 move semantics), Hans Åberg, 2018/09/15
- Re: Automatially move from $n (was: C++11 move semantics), Frank Heckenbach, 2018/09/15
- Re: Automatially move from $n (was: C++11 move semantics), Hans Åberg, 2018/09/15
- Re: Automatially move from $n (was: C++11 move semantics), Frank Heckenbach, 2018/09/15
- Re: Automatially move from $n (was: C++11 move semantics), Hans Åberg, 2018/09/15
- Re: Automatially move from $n (was: C++11 move semantics), Frank Heckenbach, 2018/09/15
- Re: Automatially move from $n (was: C++11 move semantics), Hans Åberg, 2018/09/15
- Re: Automatially move from $n (was: C++11 move semantics),
Frank Heckenbach <=
- Re: Automatially move from $n (was: C++11 move semantics), Hans Åberg, 2018/09/15
- Re: Automatially move from $n (was: C++11 move semantics), Frank Heckenbach, 2018/09/15
- Re: Automatially move from $n (was: C++11 move semantics), Hans Åberg, 2018/09/15
- Re: Automatially move from $n (was: C++11 move semantics), Frank Heckenbach, 2018/09/15
- Re: Automatially move from $n (was: C++11 move semantics), Hans Åberg, 2018/09/15
- Re: Automatially move from $n (was: C++11 move semantics), Frank Heckenbach, 2018/09/16
- Re: Automatially move from $n (was: C++11 move semantics), Hans Åberg, 2018/09/16
- Re: Automatially move from $n (was: C++11 move semantics), Frank Heckenbach, 2018/09/16
- Re: Automatially move from $n (was: C++11 move semantics), Hans Åberg, 2018/09/16
- Re: Automatially move from $n (was: C++11 move semantics), Frank Heckenbach, 2018/09/17