Discussion: Rvalue refs and a Move construtor for D

Manu turkeyman at gmail.com
Thu Aug 29 04:38:03 UTC 2019


On Wed, Aug 28, 2019 at 8:45 PM Suleyman via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> On Thursday, 29 August 2019 at 01:01:36 UTC, Mike Franklin wrote:
> > The proposals presented seem to focus primarily on move
> > semantics, but one of the other issues rvalue references aimed
> > to solve was perfect forwarding.  How does D do perfect
> > forwarding with your proposal or without rvalue references?
> >
> > Mike
>
> I discussed this with Manu which is pro rvalue ref and he made a
> lot of good points, the most important thing is that rvalue ref
> would drastically simplify the implementation of
> `core.lifetime.move()`.
>
> But he pointed out that auto ref already does perfect forwarding.

It's a _part_ of perfect forwarding; the part that allows a function
to receive forwarded arguments.
The other part is a `forward` implementation passes them forward (and
actually works), and that depends on a `move` implementation that
works.
Perfect forwarding in D would be a combination of `auto ref` and `forward`.
We have all the concepts we need, so I don't think that's actually
related to this topic. If we define non-trivial move, those forwarding
concepts should certainly map, or the proposal would fail instantly.


More information about the Digitalmars-d mailing list