[C++-sig] Custom smart pointer with same behaviour as shared_ptr

Andrea mariofutire at googlemail.com
Sat Jan 19 22:55:42 CET 2008


john haddon wrote:
>>> Other point: please correct me if I am wrong.
>>> I need to register every class I want to be able to cast to (i.e. every class I want to accept as 
>>> argument).
>>> So in that case I need to add both
>>>
>>> INTRUSIVE_PTR_PATCH(B, B_class);
>>> and
>>> INTRUSIVE_PTR_PATCH(C, C_class);
>>>
>>> so that my functions can take intrusive_ptr of type B and C.
>>> No need to do it with A.
> 
> Taking a look at our bindings again, I think it would be wise to do the same for A too. Sorry if
> I'm a little vague on this subject - it was a while ago and I didn't actually write all the code...

Yes, you are right. It is needed when I have a pointer to a derived class and I need to pass is as 
base class.

It seems that I have to pair INTRUSIVE_PTR_PATCH with each class_ declaration.
It would be nice if it could be added to class_ so it is done automatically.


Thanks




More information about the Cplusplus-sig mailing list