Boost logo

Boost Users :

From: Thomas Laguzzi (tholag_at_[hidden])
Date: 2006-03-17 13:22:16


Hello,
I use intrusive_ptr with a class that holds the refcount and I derive
from that class all my other classes.

class TObject {
 public :
int refcount ;

TObject () { refcount = 0;}

}
I have defined the intrusive_..._addref and _release to increase and
decrease/delete that refcount and everything works good!

Anywhay sometimes I need to assign a derived object to another derived
object of the same type

instrusive_ptr <Derived> A = new Derived;
.
.
.
the problem:
*A = *Derived(constr parameters).
The point is that the refcount is assigned too (and becames 0)

How are instrusive_addref and _release supposed to be implemented ?

Any quick and clean solution for that ? I cannot write assignment
operator for every derived class because... there are a lot of members
:)

Really thanks!
Thomas


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net