Discussion: Rvalue refs and a Move construtor for D
kinke
noone at nowhere.com
Thu Sep 5 18:34:07 UTC 2019
On Thursday, 5 September 2019 at 17:53:29 UTC, Suleyman wrote:
> That sounds like an optional optimization for the compiler.
> That's if the compiler finds that s is never used after the
> call to bar.
It could be, but I'm more interested in allowing this with an
explicit move (incl. allowed reuse of that lvalue later). Then I
don't see any reason for rvalue refs in D.
> Calling the destructor twice is not more efficient than one
> call to the move constructor and one call to the destructor.
C++/your current proposal ends in 2 destructions too (moved-to
temporary and moved-from lvalue), so there's no overhead at all.
More information about the Digitalmars-d
mailing list