On Sunday, 26 October 2014 at 14:14:43 UTC, Maxime
Chevalier-Boisvert wrote:
I'll do that if I have to, but it's cleaner with an override of
new as it makes it impossible to mistakenly allocate the object
outside of the pool. It's also nicer if you can pass arguments
to your constructor.
Such thing are not very appreciated. But if you really want it,
you can declare one disabled constructor, it will deny
construction of an object, and declare a normal member function,
which can serve as an initializer. Also emplace passes arguments
to constructor, it can be done for any function, you can just
copy emplace's source and tweak to your liking (if you're going
to disable the constructor). If you think, simple type inference
is not enough and want a real signature copy, you can look at the
BlackHole template.