Memory pool that allocates blocks of a fixed value type.

Synopsis

Declared in <bslstl_simplepool.h>

template<
    class VALUE,
    class ALLOCATOR>
class SimplePool
    : public SimplePool_Type<ALLOCATOR>::AllocatorType

Description

This class provides methods for creating and deleting nodes using the appropriate allocator‐traits of the parameterized ALLOCATOR. This type is intended to be used as a private base‐class for a node‐based container, in order to take advantage of the empty‐base‐class optimization in the case where the base‐class has 0 size (as may the case if the parameterized ALLOCATOR is not a bslma::Allocator).

Base Classes

Name

Description

SimplePool_Type<ALLOCATOR>::AllocatorType

Type Aliases

Name

Description

AllocatorTraits

Alias for the allocator traits for the parameterized ALLOCATOR.

AllocatorType

Alias for the allocator type for a bsls::AlignmentUtil::MaxAlignedType.

ValueType

Alias for the parameterized type VALUE.

size_type

Unsigned integer type measuring pool size.

Member Functions

Name

Description

SimplePool [constructor]

Create a memory pool that adopts the allocations of original.

SimplePool [constructor]

Create a memory pool that uses the specified allocator.

~SimplePool [destructor]

Destroy this pool, releasing all associated memory back to the underlying allocator.

adopt

Adopt all outstanding allocations from the specified pool.

allocate

Return the address of a block of memory of at least the size of VALUE. Note that the memory is not initialized.

allocator

Return a modifiable reference to this pool's rebound allocator.

allocator

Return a non‐modifiable reference to this pool's rebound allocator.

deallocate

Relinquish the memory block at address back to this pool.

hasFreeBlocks

Return true if this object holds free (currently unused) blocks, and false otherwise.

quickSwapExchangeAllocators

Exchange this pool's memory blocks and allocator with those of other.

quickSwapRetainAllocators

Exchange this pool's memory blocks with those of other.

release

Relinquish all memory currently allocated via this pool object.

reserve

Reserve memory for at least the specified numBlocks.

swap

Exchange this pool's memory blocks with those of other.

Created with MrDocs