Discussion: Rvalue refs and a Move construtor for D

Manu turkeyman at gmail.com
Thu Sep 5 21:45:10 UTC 2019


On Thu, Sep 5, 2019 at 2:40 PM kinke via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> 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.

Please no. This is a terrible series of sentences >_<
`-preview=rvaluerefparam` naturally interacts benefitially with the
proposed `@rvalue` attribute. Don't mess with that.


More information about the Digitalmars-d mailing list