
9 Apr
2008
9 Apr
'08
6:13 p.m.
On Wed, 2008-04-09 at 13:40 -0400, Frank Mori Hess wrote:
But *this inside enable_shared_from_this<T> is not a T*, it is a enable_shared_from_this<T>*. To downcast it to a T* requires a dynamic_cast for the general case, which requires a vtable. Not that I consider a vtable to be significant overhead (I know, it's a horrifiying opinion for a C++ programmer but there it is).
static_cast<T*>(this) should be legal AFAIK (and doesn't need a vtable) Regards, Daniel