Boost logo

Boost Users :

Subject: Re: [Boost-users] shared pointer problem - can't destruct
From: Igor R (boost.lists_at_[hidden])
Date: 2011-10-06 02:42:21

> I've got a class A that created class Bs
> class B needs to register callbacks to the class A that created it.
> So I made member variables in class B that are boost::function type
> class A binds the method to be called and hands that to class B on construction
> So, not class A always has a reference count and cannot be destoryed.
> I tried passing a weak_ptr to boost::bind instead and it won't compile.

You can either change your design, so that in one of the directions
you pass raw ptr and a weak_ptr for tracking, or take a look at this

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at