
Pavel Vozenilek wrote:
Allocator just allocates N bytes, object creates itself via placement new.
This will not work unless every class that derives from singleton defines its own create method. The singleton base itself cannot call placement new, because it does not have access to the protected parts of a derived class.
Instead of try/catch shared_array should be used to avoid destroying stack frame when exception throws.
I'm tempted, except for the fact that it would only be needed in this one place and adds a dependency on the shared_array library, which is only needed for an implementation detail. Right now, there are no external dependencies and I don't think it would be worth it to save my implementation three lines of code. -Jason