overload operator new with a spcialized memory manager instance

M

Maximus

I am trying to find a way to overload operator new of a class to use a
specialzied memory manager. In my design multiple memory managers exist. I
need to pass the instance of a memory manager into operator new. In ANSI C,
it is quite simple, like this:

type_t* ansi_c_init(MemoryManager* m)
{
type_t* a = (type_t*)->alloc_bytes(sizeof(type_t));
a->memory_manager = m;
}


According to my read, the new() overload is actually a static method and can
not call any members. So my question is, it is a backward in C++? Is it even
possible to customize memory allocation with a specialized memory manager?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top