Discussion: Rvalue refs and a Move construtor for D

kinke noone at nowhere.com
Thu Sep 5 21:36:03 UTC 2019

On Thursday, 5 September 2019 at 19:38:57 UTC, Suleyman wrote:
> The whole program only calls the destructor for the lvalue, and 
> only once. You need a competitive alternative.

Sry, I haven't focused on that - yes, rvalue refs would be even 
faster because of elided destruction + T.init reset. For 
hard-core guys wanting to optimize that away, I'd suggest to just 
use a regular ref in the function signature and enable 
`-preview=rvaluerefparam`. A regular ref (combined with either 
pragma(mangle) tricks or some UDA for C++ mangling) could also be 
used to represent C++ functions with rvalue refs.

More information about the Digitalmars-d mailing list