Move Constructors - Converting Lvalues to Rvalues
Manu
turkeyman at gmail.com
Wed Oct 2 23:07:03 UTC 2024
On Thu, 3 Oct 2024 at 03:21, Walter Bright via Digitalmars-d <
digitalmars-d at puremagic.com> wrote:
> On 10/1/2024 1:15 PM, Timon Gehr wrote:
> > I guess the new implementation you have in mind is something like the
> following?
> >
> > ```d
> > auto move(T)(ref T arg)=>__rvalue(arg);
> > ```
>
> Not exactly. __rvalue would also convert an rvalue to an rvalue.
>
-preview=rvaluerefparams addresses this; it allows an rvalue to be supplied
to the lvalue there. It's actually an essential mechanic to this whole
thing, because it will allow the appropriate selection of copy/move
overloads where a type may define either one, or both. If a copy and/or
move constructor exists, it needs to select the proper one, and the
-preview handles that properly as is.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20241003/7c1e958d/attachment.htm>
More information about the Digitalmars-d
mailing list