$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Nat Goodspeed (ngoodspeed_at_[hidden])
Date: 2007-05-10 14:20:38
________________________________________
From: boost-users-bounces_at_[hidden] [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Olivier Tournaire
Sent: Thursday, May 10, 2007 2:08 PM
To: boost-users_at_[hidden]
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<A *> 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).