I think you can use boost::weak_ptr .
using boost::shared_ptr; using boost::weak_ptr; func (weak_ptr<MyClass> wp) { shared_ptr<MyClass> sp = wp.lock (); if (sp)
Basically, this is an example suggested in the boost::weak_ptr . Here is the link .
source share