Discussion: Rvalue refs and a Move construtor for D

Manu turkeyman at gmail.com
Sat Sep 7 20:39:19 UTC 2019


On Sat, Sep 7, 2019 at 1:30 PM Suleyman via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> On Saturday, 7 September 2019 at 06:03:38 UTC, Manu wrote:
> > On Fri, Sep 6, 2019 at 3:55 PM Suleyman via Digitalmars-d
> > <digitalmars-d at puremagic.com> wrote:
> >>
> >> On Friday, 6 September 2019 at 22:32:55 UTC, Manu wrote:
> >> > S is an rvalue; there are no other references to S. That's
> >> > the point.
> >>
> >> With rvalue ref there is a reference. That's the point of
> >> rvalue ref passing rvalue around by reference.
> >
> > The whole point is to destroy the source value though, because
> > there's no external reference to it. If you receive an rvalue
> > ref, it's yours to do as you like with it.
>
> Yes you can do anything including rendering the object invalid
> and even without this feature. You don't need this feature
> because it generally doesn't make sense and you can do without it.

I don't know what you mean. It absolutely makes sense, and it's very useful.


More information about the Digitalmars-d mailing list