Boost logo

Boost Users :

Subject: Re: [Boost-users] [enable_shared_from_this] My derivation ofenable_shared_from_this wants to be templated
From: Peter Dimov (pdimov_at_[hidden])
Date: 2009-03-04 15:03:31


Rob Currey:
> template<class X>
> class Y: public enable_shared_from_this< Y<X> >
> {
> public:
>
> shared_ptr< Y<X> > f()
> {
> return shared_from_this();

In a template, you need

           return this->shared_from_this();

to inform the compiler that shared_from_this will come from a base class.

> }
> };


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