<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 15 Oct 2024, 23:06 RazvanN via Digitalmars-d, <<a href="mailto:digitalmars-d@puremagic.com">digitalmars-d@puremagic.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Tuesday, 15 October 2024 at 12:56:35 UTC, RazvanN wrote:<br>
<br>
>> Isn't this the exact moment that the recursion ends? If the <br>
>> copy ctor was an exact match (we must have been supplied an <br>
>> lvalue), and (therefore) while considering the move <br>
>> constructor it was determined that a copy is necessary, then <br>
>> it is not an exact match... copy ctor wins. Case closed.<br>
>><br>
<br>
Note that today, from the compilers perspective both the move <br>
ctor and<br>
the copy ctor are exact matches. However, the compiler does a <br>
thing called<br>
partial ordering where it selects the function that is more <br>
specialized.<br>
This is where ref gets picked of rvalue because it is deemed more <br>
specialized.<br>
<br>
So, all you need to do is just tweak this and simply add a check <br>
for the situation<br>
where a copy constructor is preferred over the move constructor.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Okay, but again with the constructor; does that rule generalise to any regular function argument?</div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>