void f(void)
{
cout << "this is working " << boost::enable_shared_from_this<B>::shared_from_this() << endl;
}
};

You create an empty enable_shared_from_this<B>, then call shared_from_this() on that one which is of course empty. Intended usage is

class B : public A, public boost::enable_shared_from_this<B>
{
public:
B() {}
virtual ~B() {}

void f(void)
{
cout << "this is working " << shared_from_this() << endl;
                                          // ^^^^^^^^^^^^^^^^^^^^^^
}
};

This is not the only error though, Since you're deriving from enable_shared_from_this two times, the above will give an ambiguous call error (did you mean enable_shared_from_this<A> or enable_shared_from_this<B>).

Since you're not calling shared_from_this() in A, I suggest you remove enable_shared_from_this<A> altogether.


/ christian
 
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users