Frank Mori Hess wrote:
Okay, here's the partial-template-specialization proof of concept, where polymorphism is confined to a specialization of enable_shared_from_this.
It's a partial template specialization and not all compilers support that well enough. I know that you can work around this and I don't want to be a spoilsport, but I think this is a too intrusive approach for the limited purpose it satisfies. What about exception safety regarding the call to postconstruct, for example? What if a derived class implements postconstruct for its own purposes and doesn't forward it up the class hierarchy? Wouldn't you need a predestruct for this to be usable for more than your specific needs? I think you're better off writing a specialized smart pointer if you want that kind of functionality. Regards Timmo Stange