Memory manager that creates and deletes nodes for tree‐based containers.

Synopsis

Declared in <bslstl_treenodepool.h>

template<
    class VALUE,
    class ALLOCATOR>
class TreeNodePool;

Description

This class provides methods for creating and deleting nodes using the appropriate allocator traits of the (template parameter) type 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 be the case if the (template parameter) type ALLOCATOR is not a bslma::Allocator).

Type Aliases

Name

Description

AllocatorType

Alias for the allocator type defined by SimplePool.

size_type

Alias for the size_type of the allocator defined by SimplePool.

Member Functions

Name

Description

TreeNodePool [constructor]

Constructors

adopt

Adopt all outstanding allocations from the specified pool.

allocator

allocator overloads

cloneNode

Allocate a node and copy‐construct its value from original.

deleteNode

Destroy the value of node and return its memory to this pool.

emplaceIntoNewNode

Allocate a node and emplace‐construct its value from args.

hasFreeNodes

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

moveIntoNewNode

Allocate a node and move‐construct its value from original.

reserveNodes

Reserve memory for at least the specified numNodes.

swap

Exchange this pool's nodes with those of other.

swapExchangeAllocators

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

swapRetainAllocators

Exchange this pool's nodes with those of other.

Created with MrDocs