[#BloombergLP-bslstl-SimplePool] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::SimplePool :relfileprefix: ../../ :mrdocs: 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`). == Synopsis Declared in `<bslstl_simplepool.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class VALUE, class ALLOCATOR> class SimplePool : public SimplePool_Type<ALLOCATOR>::AllocatorType ---- == Base Classes [cols="1,4"] |=== | Name| Description | `SimplePool_Type<ALLOCATOR>::AllocatorType` | |=== == Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslstl/SimplePool/AllocatorTraits.adoc[`AllocatorTraits`] | Alias for the allocator traits for the parameterized `ALLOCATOR`. | xref:BloombergLP/bslstl/SimplePool/AllocatorType.adoc[`AllocatorType`] | Alias for the allocator type for a `bsls::AlignmentUtil::MaxAlignedType`. | xref:BloombergLP/bslstl/SimplePool/ValueType.adoc[`ValueType`] | Alias for the parameterized type `VALUE`. | xref:BloombergLP/bslstl/SimplePool/size_type.adoc[`size_type`] | Unsigned integer type measuring pool size. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslstl/SimplePool/2constructor-01.adoc[`SimplePool`] [.small]#[constructor]# | Create a memory pool, adopting all outstanding memory allocations associated with the specified `original` pool, that returns blocks of contiguous memory of the sizeof the paramterized `VALUE` using the allocator associated with `original`. The chunk size is set to that of `original` and continues to double in size up to an implementation defined maximum number of blocks per chunk. Note that `original` is left in a valid but unspecified state. | xref:BloombergLP/bslstl/SimplePool/2constructor-0d.adoc[`SimplePool`] [.small]#[constructor]# | Create a memory pool that returns blocks of contiguous memory of the size of the parameterized `VALUE` using the specified `allocator` to supply memory. The chunk size grows starting with at least `sizeof(VALUE)`, doubling in size up to an implementation defined maximum number of blocks per chunk. | xref:BloombergLP/bslstl/SimplePool/2destructor.adoc[`~SimplePool`] [.small]#[destructor]# | Destroy this pool, releasing all associated memory back to the underlying allocator. | xref:BloombergLP/bslstl/SimplePool/adopt.adoc[`adopt`] | Adopt all outstanding memory allocations associated with the specified memory `pool`. The behavior is undefined unless this pool uses the same allocator as that associated with `pool`. The behavior is undefined unless this pool is in the default‐constructed state. | xref:BloombergLP/bslstl/SimplePool/allocate.adoc[`allocate`] | Return the address of a block of memory of at least the size of `VALUE`. Note that the memory is _not_ initialized. | xref:BloombergLP/bslstl/SimplePool/allocator-01.adoc[`allocator`] | Return a reference providing modifiable access to the rebound allocator traits for the node‐type. Note that this operation returns a base‐class (`AllocatorType`) reference to this object. | xref:BloombergLP/bslstl/SimplePool/allocator-0d.adoc[`allocator`] | Return a reference providing non‐modifiable access to the rebound allocator traits for the node‐type. Note that this operation returns a base‐class (`AllocatorType`) reference to this object. | xref:BloombergLP/bslstl/SimplePool/deallocate.adoc[`deallocate`] | Relinquish the memory block at the specified `address` back to this pool object for reuse. The behavior is undefined unless `address` is non‐zero, was allocated by this pool, and has not already been deallocated. | xref:BloombergLP/bslstl/SimplePool/hasFreeBlocks.adoc[`hasFreeBlocks`] | Return `true` if this object holds free (currently unused) blocks, and `false` otherwise. | xref:BloombergLP/bslstl/SimplePool/quickSwapExchangeAllocators.adoc[`quickSwapExchangeAllocators`] | Efficiently exchange the memory blocks and the allocator of this object with those of the specified `other` object. This method provides the no‐throw exception‐safety guarantee. | xref:BloombergLP/bslstl/SimplePool/quickSwapRetainAllocators.adoc[`quickSwapRetainAllocators`] | Efficiently exchange the memory blocks of this object with those of the specified `other` object. This method provides the no‐throw exception‐safety guarantee. The behavior is undefined unless `allocator() == other.allocator()`. | xref:BloombergLP/bslstl/SimplePool/release.adoc[`release`] | Relinquish all memory currently allocated via this pool object. | xref:BloombergLP/bslstl/SimplePool/reserve.adoc[`reserve`] | Dynamically allocate a new chunk containing the specified `numBlocks` number of blocks, and add the chunk to the free memory list of this pool. The additional memory is added irrespective of the amount of free memory when called. The behavior is undefined unless `0 < numBlocks`. | xref:BloombergLP/bslstl/SimplePool/swap.adoc[`swap`] | Efficiently exchange the memory blocks of this object with those of the specified `other` object. This method provides the no‐throw exception‐safety guarantee. The behavior is undefined unless `allocator() == other.allocator()`. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#