Move construction from !is(T == typeof(this))
via Digitalmars-d
digitalmars-d at puremagic.com
Mon Apr 24 07:21:20 PDT 2017
On Monday, 24 April 2017 at 14:00:33 UTC, Steven Schveighoffer
wrote:
> On 4/24/17 12:21 AM, Manu via Digitalmars-d wrote:
>
>> I wonder if this overload set could be made to work such that
>> it is
>> certain that the non-ref overload is only called with rvalues;
>> ie, given
>> this ambiguous call, ref is preferred for lvalues. rval can
>> not call
>> ref, therefore must resolve to byval.
>
> AFAIK, if you have an overload that varies solely on ref, then
> rvalues go to the non-ref and lvalues go to the ref. If this is
> not the case, it's *intended* to be the case, and should be
> filed as a bug.
>
> auto ref just templates that. And in your case, it's actually
> clearer and cleaner not to use auto ref.
>
> Not sure if this answers your question, or if it turns out to
> be a viable solution.
>
> -Steve
https://issues.dlang.org/show_bug.cgi?id=17346
More information about the Digitalmars-d
mailing list