Custom memory alloc and dealloc which multiple Inheritance class
问题 i want do memory management in my project. i do not want operator global new/delete so i implement a simple memory alloctor. this is my code: class IAllocator { public: void* Alloc( unsigned int size ) { 1. alloc memory. 2. trace alloc. } void Dealloc( void* ptr ) { 1. free memory. 2. erase trace info. } template< typename T > void Destructor( T* ptr ) { if ( ptr ) ptr->~T(); } }; // macro for use easy. # define MYNEW( T ) new ( g_Allocator->Alloc( sizeof( T ) ) ) T # define MYDEL( ptr ) if