Discussion: Rvalue refs and a Move construtor for D

Les De Ridder les at lesderid.net
Thu Sep 5 13:03:04 UTC 2019


On Thursday, 5 September 2019 at 12:09:33 UTC, Eduard Staniloiu 
wrote:
> On Wednesday, 4 September 2019 at 21:59:46 UTC, kinke wrote:
>> On Wednesday, 4 September 2019 at 21:09:27 UTC, Exil wrote:
> [...]
> 
> I would expect the contents of the moved lvalue to be reset to 
> `Foo.init`.

I believe that's what kinke is proposing too?

In C++, objects that are moved from should be left in an 
unspecified but
valid state. It is up to the move constructor to guarantee that 
this
rule is actually satisfied.

As I understand it, because we generally try to avoid the C++ 
convention
of only guaranteeing things by ... convention, it could make 
sense to
reset moved-from lvalues to `T.init` implicitly.


More information about the Digitalmars-d mailing list