Move construction from !is(T == typeof(this))

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Mon Apr 24 07:00:33 PDT 2017


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


More information about the Digitalmars-d mailing list