[#BloombergLP-bslstl-SimplePool]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::SimplePool
:relfileprefix: ../../
:mrdocs:

Memory pool that allocates blocks of a fixed value type&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;simplepool&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class VALUE,
    class ALLOCATOR&gt;
class SimplePool
    : public SimplePool&lowbar;Type&lt;ALLOCATOR&gt;::AllocatorType
----

== Description

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

== Base Classes

[cols="1,4"]
|===
| Name| Description
| `SimplePool&lowbar;Type&lt;ALLOCATOR&gt;::AllocatorType`
| 
|===

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslstl/SimplePool/AllocatorTraits.adoc[`AllocatorTraits`] 
| Alias for the allocator traits for the parameterized `ALLOCATOR`&period;
| xref:BloombergLP/bslstl/SimplePool/AllocatorType.adoc[`AllocatorType`] 
| Alias for the allocator type for a `bsls&colon;&colon;AlignmentUtil&colon;&colon;MaxAlignedType`&period;
| xref:BloombergLP/bslstl/SimplePool/ValueType.adoc[`ValueType`] 
| Alias for the parameterized type `VALUE`&period;
| xref:BloombergLP/bslstl/SimplePool/size_type.adoc[`size&lowbar;type`] 
| Unsigned integer type measuring pool size&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslstl/SimplePool/2constructor-01.adoc[`SimplePool`]         [.small]#[constructor]#
| Create a memory pool that adopts the allocations of `original`&period;
| xref:BloombergLP/bslstl/SimplePool/2constructor-0d.adoc[`SimplePool`]         [.small]#[constructor]#
| Create a memory pool that uses the specified `allocator`&period;
| xref:BloombergLP/bslstl/SimplePool/2destructor.adoc[`&#126;SimplePool`] [.small]#[destructor]#
| Destroy this pool, releasing all associated memory back to the underlying allocator&period;
| xref:BloombergLP/bslstl/SimplePool/adopt.adoc[`adopt`] 
| Adopt all outstanding allocations from the specified `pool`&period;
| xref:BloombergLP/bslstl/SimplePool/allocate.adoc[`allocate`] 
| Return the address of a block of memory of at least the size of `VALUE`&period; Note that the memory is _not_ initialized&period;
| xref:BloombergLP/bslstl/SimplePool/allocator-01.adoc[`allocator`] 
| Return a modifiable reference to this pool&apos;s rebound allocator&period;
| xref:BloombergLP/bslstl/SimplePool/allocator-0d.adoc[`allocator`] 
| Return a non&hyphen;modifiable reference to this pool&apos;s rebound allocator&period;
| xref:BloombergLP/bslstl/SimplePool/deallocate.adoc[`deallocate`] 
| Relinquish the memory block at `address` back to this pool&period;
| xref:BloombergLP/bslstl/SimplePool/hasFreeBlocks.adoc[`hasFreeBlocks`] 
| Return `true` if this object holds free (currently unused) blocks, and `false` otherwise&period;
| xref:BloombergLP/bslstl/SimplePool/quickSwapExchangeAllocators.adoc[`quickSwapExchangeAllocators`] 
| Exchange this pool&apos;s memory blocks and allocator with those of `other`&period;
| xref:BloombergLP/bslstl/SimplePool/quickSwapRetainAllocators.adoc[`quickSwapRetainAllocators`] 
| Exchange this pool&apos;s memory blocks with those of `other`&period;
| xref:BloombergLP/bslstl/SimplePool/release.adoc[`release`] 
| Relinquish all memory currently allocated via this pool object&period;
| xref:BloombergLP/bslstl/SimplePool/reserve.adoc[`reserve`] 
| Reserve memory for at least the specified `numBlocks`&period;
| xref:BloombergLP/bslstl/SimplePool/swap.adoc[`swap`] 
| Exchange this pool&apos;s memory blocks with those of `other`&period;
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
