Sunday, 18 August 2013

Is it possible to use custom allocation operator to create a STACK object?

Is it possible to use custom allocation operator to create a STACK object?

Ok, if I want to create a heap object with a custom new operator, I know
that I need to overload the new operator like this:
void* operator new(size_t size, int unused)
{
void* ptr = malloc(size);
//some custom code
return ptr;
}
And then, if I want to create a heap object using this overloaded operator
I would do this:
SomeClass* a = new(0) SomeClass;
The question is: can I do something like this to create a stack object?

No comments:

Post a Comment