|
enum | {
kNodeSize = nodeSize
, kNodeCount = nodeCount
, kNodesSize = nodeCount * nodeSize
, kBufferSize = kNodesSize + ((nodeAlignment > 1) ? nodeSize-1 : 0) + nodeAlignmentOffset
,
kNodeAlignment = nodeAlignment
, kNodeAlignmentOffset = nodeAlignmentOffset
} |
|
typedef fixed_pool | pool_type |
|
typedef fixed_node_allocator< nodeSize, nodeCount, nodeAlignment, nodeAlignmentOffset, false, OverflowAllocator > | this_type |
|
typedef OverflowAllocator | overflow_allocator_type |
|
|
| fixed_node_allocator (void *pNodeBuffer) |
|
| fixed_node_allocator (void *pNodeBuffer, const overflow_allocator_type &) |
|
| fixed_node_allocator (const this_type &x) |
|
this_type & | operator= (const this_type &x) |
|
void * | allocate (size_t n, int=0) |
|
void * | allocate (size_t n, size_t alignment, size_t offset, int=0) |
|
void | deallocate (void *p, size_t) |
|
bool | can_allocate () const |
|
void | reset (void *pNodeBuffer) |
|
const char * | get_name () const |
|
void | set_name (const char *pName) |
|
const overflow_allocator_type & | get_overflow_allocator () const EA_NOEXCEPT |
|
overflow_allocator_type & | get_overflow_allocator () EA_NOEXCEPT |
|
void | set_overflow_allocator (const overflow_allocator_type &) |
|
void | copy_overflow_allocator (const this_type &) |
|
◆ fixed_node_allocator()
template<size_t nodeSize, size_t nodeCount, size_t nodeAlignment, size_t nodeAlignmentOffset, typename OverflowAllocator >
fixed_node_allocator
Note that we are copying x.mpHead to our own fixed_pool. This at first may seem broken, as fixed pools cannot take over ownership of other fixed pools' memory. However, we declare that this copy ctor can only ever be safely called when the user has intentionally pre-seeded the source with the destination pointer. This is somewhat playing with fire, but it allows us to get around chicken-and-egg problems with containers being their own allocators, without incurring any memory costs or extra code costs. There's another reason for this: we very strongly want to avoid full copying of instances of fixed_pool around, especially via the stack. Larger pools won't even be able to fit on many machine's stacks. So this solution is also a mechanism to prevent that situation from existing and being used. Perhaps some day we'll find a more elegant yet costless way around this.
The documentation for this class was generated from the following file: