rvalue based copy

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Mar 30 10:44:41 PDT 2015


On 3/30/15 1:42 PM, matovitch wrote:
> On Monday, 30 March 2015 at 17:21:53 UTC, Steven Schveighoffer wrote:
>   Annoying as this is (and blatantly awkward), it saves
>> you from having to implement twice:
>>
>> void opAssign(T)(auto ref const T s) if(is(T == S)) {...}
>
> Yep, this seems awkward to me too thought according to Adam one can do :
>
> void opAssign()(auto ref const S s) {...}

Yeah, if Adam says it works, it probably does. I thought it didn't, but 
I think it's only types that don't allow you to omit the compile-time 
parameters, not functions.

-Steve


More information about the Digitalmars-d-learn mailing list