opAssign and template class
dbjdbj
dbj at dbj.org
Wed Feb 5 05:38:07 PST 2014
>
> You can't. Classes are reference types. This just doesn't make
> sense: x2 = x_; does not create any new objects.
*object_alive* is what I mentioned, not object_create
therefore it does "make sense" ... so here it is again:
auto x_ = new X() , // created:1 , alive: 1
x2 = x_ ; // created:1 , alive: 2
I tried (in all of my D innocence) to implement simple but
effective counter from C++ side of the "wall" ... using the CRTP
idiom ...
More information about the Digitalmars-d
mailing list