Template Class memory_pool

Class Documentation

template<typename Container>
class apex::containers::memory_pool

A combined storage and pool class. This class over-allocates memory by a factor of two. This is because STL containers do not uniformly allocate memory for each new node.

Template Parameters

Container – The apex::containers type to set up this pool for

Public Types

using container = Container

The container type this memory pool is adaptered to.

Public Functions

inline explicit memory_pool(const std::size_t capacity)

Constructor.

Parameters

capacity[in] The number of elements for the given container type that this memory pool is prealloacted to store

inline operator node_pool_t&()

Implicit conversion to the underlying RawAllocator.

template<typename ...Args>
inline decltype(auto) create(Args&&... args)

Construct the container with the given arguments.

Template Parameters

Args – A parameter pack for forwarded constructor arguments

Parameters

args[in] Arguments passed directly to the container constructor (except for allocator)