Boost logo

Boost :

From: Fernando Cacciola (fernando_cacciola_at_[hidden])
Date: 2007-11-17 12:44:26

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 :)


Fernando Cacciola

Boost list run by bdawes at, gregod at, cpdaniel at, john at