
Hi Corrado,
Can inplace factory export an other method, that will invoke new T() with the appropriate parameters and return the pointer to it?
It clearly could, though it worries me than in that case it wouldn't be an "in-place" factory but just a ordinary factory. While I can understand your need from your side, specially assuming that the pointer is an implementation detail, it feels a bit of a hack from the in-place factory POV.
I can't see how to do this transparently without inplace factory support, because I don't know a way to call the correct operator new if it is defined in the class ( T::operator new(sizeof(T)) works only if T declares the operator ).
I'm getting rusty on C++ lately writting so much C# and Ruby code, but IIRC typical implementations of new call malloc() then in place new, so, couldn't you do the same? (I don't recall if malloc() itself or the implementation of new takes care of alignment.... damn, I'm getting old :) HTH -- -------- Fernando Cacciola SciSoft http://certuscode.wordpress.com http://fcacciola.50webs.com http://fcacciola.wordpress.com