opAssign and template class

Stanislav Blinov stanislav.blinov at gmail.com
Wed Feb 5 05:15:39 PST 2014


On Wednesday, 5 February 2014 at 12:29:11 UTC, dbjdbj wrote:

> 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 ...

You can't. Classes are reference types. This just doesn't make 
sense: x2 = x_; does not create any new objects.


More information about the Digitalmars-d mailing list