Reputation: 6296
I have read a bunch about smart ptr, and have decided to use intrusive_ptr with my own implementation for reference counting.
Said that, I have to face now another problem, how to solve reference cycles taking into account weak_ptr can't be used with the auto_ptr class.
Will it be a good thing to resolve the cycles using raw pointers where weak references should be stored? The consecuences of this are that if the strong reference is deleted weak references will not be notified/zeroed, but I think that arquitecting correctly the dependencies it could be a good option, but I could be wrong here.
Could anybody give any opinion about this?.
Upvotes: 0
Views: 322
Reputation: 249394
Just use shared_ptr
. It's easier to use, and works with weak_ptr
which you mentioned. Maybe someday you'll find a case where you want to use intrusive, but until then, keep it simple.
Upvotes: 1