ROSE 0.11.145.147
|
Allocator proxy.
Allocators are copied by value when containers are created, which means that each container would normally have its own allocator. However, sometimes, like for pool allocators, performance can be better if multiple containers could share an allocator. An allocator proxy allows containers to share allocators by having the proxy reference the allocator. When the proxy is copied, the new copy continues to point to the original allocator.
Example usage:
Definition at line 60 of file DefaultAllocator.h.
#include <Sawyer/DefaultAllocator.h>
Public Member Functions | |
ProxyAllocator (Allocator &allocator) | |
Constructor. | |
void * | allocate (size_t size) |
Allocate memory. | |
void | deallocate (void *addr, size_t size) |
Deallocate memory. | |
|
inline |
Constructor.
The constructor stores a reference to the allocator
within the new proxy object. All copies of the proxy will refer to the same allocator.
Definition at line 67 of file DefaultAllocator.h.
|
inline |
Allocate memory.
Allocates new memory by delegating to the underlying allocator.
Definition at line 74 of file DefaultAllocator.h.
|
inline |
Deallocate memory.
Deallocates memory by delegating to the underlying allocator.
Definition at line 81 of file DefaultAllocator.h.