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

This class provides methods for creating and deleting nodes using the appropriate allocator traits of the (template parameter) type `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 class has 0 size (as may be the case if the (template parameter) type `ALLOCATOR` is not a `bslma&colon;&colon;Allocator`)&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class VALUE,
    class ALLOCATOR&gt;
class TreeNodePool;
----

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslstl/TreeNodePool/AllocatorType.adoc[`AllocatorType`] 
| Alias for the allocator type defined by `SimplePool`&period;
| xref:BloombergLP/bslstl/TreeNodePool/size_type.adoc[`size&lowbar;type`] 
| Alias for the `size&lowbar;type` of the allocator defined by `SimplePool`&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslstl/TreeNodePool/2constructor-0d.adoc[`TreeNodePool`]         [.small]#[constructor]#
| Constructors
| xref:BloombergLP/bslstl/TreeNodePool/adopt.adoc[`adopt`] 
| Adopt all outstanding memory allocations associated with the specified node `pool`&period; The behavior is undefined unless this pool uses the same allocator as that associated with `pool`&period; The behavior is also undefined unless this pool is in the default&hyphen;constructed state&period;
| xref:BloombergLP/bslstl/TreeNodePool/allocator-06.adoc[`allocator`] 
| `allocator` overloads
| xref:BloombergLP/bslstl/TreeNodePool/cloneNode.adoc[`cloneNode`] 
| Allocate a node object and copy&hyphen;construct an object of the (template parameter) type `VALUE` having the same value as the specified `original` at the `value` attribute of the node&period; Return the address of the newly allocated node&period; The behavior is undefined unless `original` refers to a `TreeNode&lt;VALUE&gt;` object holding a valid (initialized) value&period;
| xref:BloombergLP/bslstl/TreeNodePool/deleteNode.adoc[`deleteNode`] 
| Destroy the `VALUE` value of the specified `node` and return the memory footprint of `node` to this pool for potential reuse&period; The behavior is undefined unless `node` refers to a `TreeNode&lt;VALUE&gt;`&period;
| xref:BloombergLP/bslstl/TreeNodePool/emplaceIntoNewNode.adoc[`emplaceIntoNewNode`] 
| Allocate a node with a newly created value object of the (template parameter) type `VALUE`, constructed by forwarding `allocator()` and the specified (variable number of) `arguments` to the corresponding constructor of `VALUE`&period; Return the address of the newly allocated node&period; This operation requires that `VALUE` be constructible from `arguments`&period;
| xref:BloombergLP/bslstl/TreeNodePool/hasFreeNodes.adoc[`hasFreeNodes`] 
| Return `true` if this object holds free (currently unused) nodes, and `false` otherwise&period;
| xref:BloombergLP/bslstl/TreeNodePool/moveIntoNewNode.adoc[`moveIntoNewNode`] 
| Allocate a node of the type `TreeNode&lt;VALUE&gt;`, and move&hyphen;construct an object of the (template parameter) type `VALUE` with the (explicitly moved) value indicated by the `value` attribute of the specified `original` node&period; Return the address of the newly allocated node&period; The object referred to by the `value` attribute of `original` is left in a valid but unspecified state&period; The behavior is undefined unless `original` refers to a `TreeNode&lt;VALUE&gt;` object holding a valid (initialized) value&period;
| xref:BloombergLP/bslstl/TreeNodePool/reserveNodes.adoc[`reserveNodes`] 
| Add to this pool sufficient memory to satisfy memory requests for at least the specified `numNodes`&period; The additional memory is added irrespective of the amount of free memory when called&period; The behavior is undefined unless `0 &lt; numNodes`&period;
| xref:BloombergLP/bslstl/TreeNodePool/swap.adoc[`swap`] 
| Efficiently exchange the nodes of this object with those of the specified `other` object&period; This method provides the no&hyphen;throw exception&hyphen;safety guarantee&period; The behavior is undefined unless `allocator() &equals;&equals; other&period;allocator()`&period;
| xref:BloombergLP/bslstl/TreeNodePool/swapExchangeAllocators.adoc[`swapExchangeAllocators`] 
| Efficiently exchange the nodes and allocator of this object with those of the specified `other` object&period; This method provides the no&hyphen;throw exception&hyphen;safety guarantee, _unless_ swapping the (user&hyphen;supplied) allocator objects can throw&period;
| xref:BloombergLP/bslstl/TreeNodePool/swapRetainAllocators.adoc[`swapRetainAllocators`] 
| Efficiently exchange the nodes of this object with those of the specified `other` object&period; This method provides the no&hyphen;throw exception&hyphen;safety guarantee&period; The behavior is undefined unless `allocator() &equals;&equals; other&period;allocator()`&period;
|===



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