Proton
1.1.1
Make porting easy from Python to C++11
|
An extended allocator using memory pool. More...
#include <proton/pool.hpp>
Static Public Member Functions | |
static void | confiscate (void *p) |
Free a memory block not dependable on T. | |
static void * | duplicate (void *p) |
Free a memory block not dependable on T. |
An extended allocator using memory pool.
Beside normal functions of std::allocator, smart_allocator also supports confiscate() and duplicate(), while confiscate(),duplicate() and allocate() must be static in smart_allocator. confiscate() is a general free function to deallocate memory blocks not dependable on T. duplicate() is a function to allocate a new memory block which size is the same as an given allocated block.
|
inlinestatic |
Free a memory block not dependable on T.
Different with deallocate(), confiscate() doesn't depend on type T information. confiscate() CAN safely free any pointer to memory blocks allocated by the same template of allocator, no matter what T is.
p | pointer to the memory block to be freed |
|
inlinestatic |
Free a memory block not dependable on T.
Different with deallocate(), confiscate() doesn't depend on type T information. confiscate() CAN safely free any pointer to memory blocks allocated by the same template of allocator, no matter what T is.
p | pointer to the memory block to be freed |