|
libhatchet
|
#include <hxfree_list.hpp>
Classes | |
| class | deleter_t |
Public Types | |
| using | value_t = T |
| using | ptr_t = hxptr<T, deleter_t> |
Public Member Functions | |
| hxfree_list (void) noexcept | |
| hxfree_list (hxfree_list &&x_) noexcept | |
| ~hxfree_list (void) noexcept | |
| template<typename... args_t_> | |
| hxptr< T, deleter_t > | allocate (args_t_ &&... args_) noexcept |
| hxsize_t | capacity (void) const |
| deleter_t | deleter (void) noexcept |
| bool | empty (void) const |
| bool | is_allocator (const T *p_) const noexcept |
| template<typename deleter_t_> | |
| bool | is_allocator (const hxptr< T, deleter_t_ > &ptr_) const noexcept |
| hxsize_t | max_size (void) const |
| void | release (T *p_) noexcept |
| template<typename deleter_t_> | |
| void | release (hxptr< T, deleter_t_ > &&ptr_) noexcept |
| void | reserve (hxsize_t size_, hxsystem_allocator_t allocator_=hxsystem_allocator_current, hxalignment_t alignment_=hxalignment) noexcept |
| hxsize_t | size (void) const |
| template<typename... args_t_> | |
| hxptr< T, deleter_t > | try_allocate (args_t_ &&... args_) noexcept |
hxfree_list - A fixed-capacity pool of T managed by a singly linked free list.
Once capacity is established (statically or via reserve), allocate constructs a T and returns an hxptr owning it. release accepts either the hxptr returned by allocate or a raw pointer, destructs *p, and returns its slot to the list.
When capacity is hxallocator_dynamic_capacity, storage must be allocated by calling reserve before use.
| using hxfree_list< T, capacity_ >::ptr_t = hxptr<T, deleter_t> |
ptr_t - Publish the hxptr type.
| using hxfree_list< T, capacity_ >::value_t = T |
value_t - Publishes the value type.
|
explicitnoexcept |
When capacity is hxallocator_dynamic_capacity storage must be allocated via reserve before use.
|
noexcept |
Move constructs from a temporary hxfree_list.
Requires hxallocator_dynamic_capacity.
|
noexcept |
All T must have been released before destruction.
|
noexcept |
| hxsize_t hxfree_list< T, capacity_ >::capacity | ( | void | ) | const |
Returns the capacity of the pool or 0 if unallocated.
|
inlinenoexcept |
Returns a deleter_t associated with this hxfree_list.
|
inline |
Returns true if no unallocated T remains.
|
noexcept |
Returns true if ptr points into this free list's storage.
|
noexcept |
Returns true if p points into this free list's storage.
|
inline |
Returns the capacity of the pool.
|
noexcept |
|
noexcept |
Destructs *p and returns its slot to the free list.
|
noexcept |
Allocates storage for size slots and enqueues them when capacity is hxallocator_dynamic_capacity.
The current capacity becomes size slots. Reallocation is not allowed. When capacity is fixed, size must equal capacity.
|
inline |
Returns the number of unallocated T available.
|
noexcept |