Boost logo

Boost :

From: Daniel Frey (d.frey_at_[hidden])
Date: 2008-04-17 11:03:09


On Thu, 2008-04-17 at 09:23 -0400, Frank Mori Hess wrote:
> No, what I was trying to convey is you have the T type inside
> enabled_shared_from_this<T>. To be clear:
>
> template<typename T>
> enable_shared_from_this
> {
> shared_ptr<T> shared_from_this(T *t);
> //...
> };

Ah, I see.

> Also, there is no reason not to add a simple helper free function:
>
> template<typename T>
> shared_ptr<T> shared_from_this(T *t)
> {
> return t->shared_from_this(t);
> }
>
> which would provide some convenience and a sanity check for the common case
> usage.

And as Peter suggested, this could be the only public interface. I
really like that idea and direction. :)

Although it's a breaking change, it seems cleaner and more powerful to
me. Peter, what's your point of view on this type of breaking change to
enable_shared_from_this' interface? Do you seriously consider it?

Regards, Daniel


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk