4 Dec
2001
4 Dec
'01
8:09 a.m.
I thought this new was provided by the language... Sorry I created the missing new operator. Francis Francis Bouchard wrote something like :
Hi, I'm trying to mage a generic class and I would like to use the placement
new operator. Is this allowed ? This would allow me to make a little
template that would take a class that woud do the allocation (using
different IOMalloc method).
Now creating an object would look like this:
void* myPreAllocatedMemory = myAllocator.Allocate(sizeof(CMyCustomClass));
CMyCustomClass* pCustomClass;
pCustomClass = new(myPreAllocatedMemory) CMyCustomClass(initData);
This gives me the error:
too many arguments to function `void * operator new(long unsigned int)'