Move Constructor Syntax

Manu turkeyman at gmail.com
Tue Oct 15 16:57:43 UTC 2024


On Tue, 15 Oct 2024, 23:06 RazvanN via Digitalmars-d, <
digitalmars-d at puremagic.com> wrote:

> On Tuesday, 15 October 2024 at 12:56:35 UTC, RazvanN wrote:
>
> >> Isn't this the exact moment that the recursion ends? If the
> >> copy ctor was an exact match (we must have been supplied an
> >> lvalue), and (therefore) while considering the move
> >> constructor it was determined that a copy is necessary, then
> >> it is not an exact match... copy ctor wins. Case closed.
> >>
>
> Note that today, from the compilers perspective both the move
> ctor and
> the copy ctor are exact matches. However, the compiler does a
> thing called
> partial ordering where it selects the function that is more
> specialized.
> This is where ref gets picked of rvalue because it is deemed more
> specialized.
>
> So, all you need to do is just tweak this and simply add a check
> for the situation
> where a copy constructor is preferred over the move constructor.
>

Okay, but again with the constructor; does that rule generalise to any
regular function argument?

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20241016/38db2dd9/attachment.htm>


More information about the Digitalmars-d mailing list