31 unsigned long end_mask,
32 unsigned long end_offs)
52 chunk* next = ch->m_next;
53 delete []
reinterpret_cast<char*
> (ch);
70 unsigned long pp =
reinterpret_cast<unsigned long> (ch+1);
72 ch->m_blocks =
reinterpret_cast<list_block*
> (pp);
130 size_t maxndx =
m_pool.nelt();
133 std::fill (b->m_data, b->m_data + maxndx,
value_type());
134 b->m_data[maxndx] = 0;
unsigned long m_end_mask
Mask for testing for an end pointer.
allocator(size_t nelt, size_t nblock, unsigned long end_mask, unsigned long end_offs)
Constructor.
void refill()
Allocate a new chunk of blocks.
size_t m_nblock
Number of blocks per chunk.
~allocator()
Destructor. Deletes all blocks from this allocator.
chunk * m_chunks
Most recent chunk allocated.
size_t m_nelt
Number of elements per block (excluding the end-pointer).
size_t m_nchunks
Current number of allocated chunks.
unsigned long m_end_offs
Offset for testing for an end pointer.
size_t nelt() const
Return the number of pointers per block (excluding the end-pointer).
size_t m_nthis
Number of blocks allocated so far from that chunk.
list_block::value_type value_type
The stored element type.
list_block * m_head
The first block in the list.
void nextblock()
Extend the list with another block.
value_type * m_insert
The current insertion point in the list.
void clear()
Erase the container.
void firstblock()
Allocate the first block of the list.
size_t m_size
The current list size.
allocator & m_pool
The list allocator.
list_block * getblock()
Allocate a new block.
A fast way to store a variable-sized collection of pointers.
One memory allocation chunk.
A single block in the list.
static size_t size(size_t nelt)
Size in bytes of a block holding nelt elements (excluding the end-pointer).
value_type m_data[1]
The elements.