D
Dave
Hello all,
In the code below, I am experiencing shared pointer problems. Specifically,
the call to shared_from_this() is dying. Can anybody out there see what I'm
doing wrong???
Thanks,
Dave
class B;
typedef boost::weak_ptr<B> WpB;
class A
{
public:
A(WpB wpB): m_wpB(wpB) {}
private:
WpB m_wpB;
};
typedef boost::shared_ptr<A> SpA;
class B: public boost::enable_shared_from_this<B>
{
public:
void foo()
{
SpA spA = SpA(new A(shared_from_this());
}
};
In the code below, I am experiencing shared pointer problems. Specifically,
the call to shared_from_this() is dying. Can anybody out there see what I'm
doing wrong???
Thanks,
Dave
class B;
typedef boost::weak_ptr<B> WpB;
class A
{
public:
A(WpB wpB): m_wpB(wpB) {}
private:
WpB m_wpB;
};
typedef boost::shared_ptr<A> SpA;
class B: public boost::enable_shared_from_this<B>
{
public:
void foo()
{
SpA spA = SpA(new A(shared_from_this());
}
};