
________________________________________ From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Olivier Tournaire Sent: Thursday, May 10, 2007 2:08 PM To: boost-users@lists.boost.org Subject: [Boost-users] Smart pointers Suppose I have two classes A and B like those ones : class A { // ... B *m_b; }; class B { // ... std::vector m_a; }; m_b is used to know who is the parent of the object. I would like to use smart pointers. How can I do this ? [Nat] Without thinking about it too hard... My first implementation would use std::vector< boost::shared_ptr<A> > for m_a (parent object responsible for lifespan of its children) and boost::weak_ptr<B> for m_b (child object not responsible for lifespan of its parent).