Boost logo

Boost Users :

From: Alex Ott (alexott_at_[hidden])
Date: 2006-10-17 07:35:40


yes, thanks

On 10/17/06, Johan Nilsson <r.johan.nilsson_at_[hidden]> wrote:
> Alex Ott wrote:
> > Hello all
> >
> > I have one problem with enable_shared_from_this - i have one Base
> > class, that inherit from enable_shared_from_this<Base>. But i also
> > need to do shared_from_this from classes inherited from Base class.
> > Without explicit inheritance from enable_shared_from_this for Derived
> > code fail, but when i do enable_shared_from_this<Derived>, my code
> > fail with "error: reference to 'shared_from_this' is ambiguous"
> > How i can resolve this issue?
>
> Do you mean something like this?
>
> ---------
>
> #include <boost/enable_shared_from_this.hpp>
>
> struct A
> : boost::enable_shared_from_this<A>
> {};
>
> struct B
> : A
> , boost::enable_shared_from_this<B>
> {
> boost::shared_ptr<B> FooB()
> {
> return boost::enable_shared_from_this<B>::shared_from_this();
> }
>
> boost::shared_ptr<A> FooA()
> {
> return boost::enable_shared_from_this<A>::shared_from_this();
> }
> };
>
> ------------
>
> HTH // Johan
>
>
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

-- 
With best wishes,                    Alex Ott, MBA
http://alexott.blogspot.com/
http://content-filtering.blogspot.com/
http://xtalk.msk.su/~ott/

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