opAssign and template class

dbjdbj dbj at dbj.org
Wed Feb 5 04:29:10 PST 2014


>
> You cannot overload identity assignment for classes. It's a 
> language construct that rebinds a reference and cannot be 
> overridden. Such opAssign overloading is only possible for 
> structs.
>
> See http://dlang.org/operatoroverloading.html#Assignment.

I need to be able to implement "=" operator so that this works:

auto x_ = new X(), x2 = x_ ;

objects)alive needs to be 2 after.

Thanks ...


More information about the Digitalmars-d mailing list