Boost logo

Boost Users :

From: Russell Hind (yg-boost-users_at_[hidden])
Date: 2003-07-19 04:25:27


Jason Winnebeck wrote:

> I tried using enable_shared_from_this with virtual inheritance, just to
> see if it would work. I couldn't get it to work. The first barrier is
> that enable_shared_from_this is a templated class, and from what I
> understand is that two template instantiations of a class are two
> entirely different classes, so I didn't even try to use virtual on that.
>

Sorry, I completely missed that enable_shared_from_this was a template
class. Yes in that case it won't work unless possibly you did something
like this

class TheBase : public enable_shared_from_this<TheBase>
{
};

class Base1 : virtual public TheBase
{
};

class Base2 : virtual public TheBase
{
};

class MyClass : public Base1, public Base2
{
};

But then you may need dynamic_casts somewhere to get the actual
interface pointer you required later so don't know if that will be possible.

Thanks

Russell


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net