12#if HX_USE_MACROS_WITH_MODULE
13#error Header does not provide macros alone.
21#if HX_CPLUSPLUS >= 202002L
24concept hxfree_list_concept_ =
requires(T_& x_) {
30#define hxfree_list_concept_ typename
43template<hxfree_list_concept_ T_, hx
size_t capacity_=hxallocator_dynamic_capacity>
60 operator bool(
void)
const {
return true; }
87 template<
typename... args_t_>
105 template<
typename deleter_t_>
117 template<
typename deleter_t_>
136 template<
typename... args_t_>
150 void enqueue_all_(
hxsize_t count_)
noexcept;
156#include "detail/hxfree_list.inl"
hxallocator(void)
Does not allocate until reserve_storage is called.
Definition hxallocator.hpp:78
deleter_t - A callable deleter that releases a T back to this hxfree_list.
Definition hxfree_list.hpp:48
void operator()(T *ptr_) noexcept
Destructs *p and returns its slot to the owning hxfree_list.
Definition hxfree_list.hpp:57
deleter_t(hxfree_list &owner_) noexcept
Constructs a deleter associated with owner.
Definition hxfree_list.hpp:52
hxsize_t capacity(void) const
Returns the capacity of the pool or 0 if unallocated.
hxfree_list(void) noexcept
When capacity is hxallocator_dynamic_capacity storage must be allocated via reserve before use.
T value_t
value_t - Publishes the value type.
Definition hxfree_list.hpp:67
bool empty(void) const
Returns true if no unallocated T remains.
Definition hxfree_list.hpp:97
hxptr< T, deleter_t > try_allocate(args_t_ &&... args_) noexcept
Constructs a T in a free slot and returns an hxptr owning it.
hxsize_t size(void) const
Returns the number of unallocated T available.
Definition hxfree_list.hpp:131
bool is_allocator(const hxptr< T, deleter_t_ > &ptr_) const noexcept
Returns true if ptr points into this free list's storage.
hxptr< T, deleter_t > ptr_t
ptr_t - Publish the hxptr type.
Definition hxfree_list.hpp:70
hxsize_t max_size(void) const
Returns the capacity of the pool.
Definition hxfree_list.hpp:109
deleter_t deleter(void) noexcept
Returns a deleter_t associated with this hxfree_list.
Definition hxfree_list.hpp:94
void reserve(hxsize_t size_, hxsystem_allocator_t allocator_=hxsystem_allocator_current, hxalignment_t alignment_=hxalignment) noexcept
Allocates storage for size slots and enqueues them.
void release(hxptr< T, deleter_t_ > &&ptr_) noexcept
Destructs *p and returns its slot to the free list.
hxptr< T, deleter_t > allocate(args_t_ &&... args_) noexcept
Constructs a T in a free slot and returns an hxptr owning it.
hxfree_list(hxfree_list &&x_) noexcept
Move constructs from a temporary hxfree_list.
bool is_allocator(const T *ptr_) const noexcept
Returns true if p points into this free list's storage.
~hxfree_list(void) noexcept
All T must have been released before destruction.
void release(T *ptr_) noexcept
hxptr<T, deleter_t> - A unique owning pointer.
Definition hxptr.hpp:30
Similar to std::allocator.
@ hxsystem_allocator_current
hxsystem_allocator_current - Use current allocation scope.
Definition hxmemory_manager.h:80
HX_C_BEGIN_ typedef unsigned int hxalignment_t
hxalignment_t - A positive integer power of 2 for aligning allocations.
Definition hxmemory_manager.h:62
int hxsystem_allocator_t
hxsystem_allocator_t - This is extendable by the application.
Definition hxmemory_manager.h:75
hxattr_noexcept hxsystem_allocator_t allocator_
Definition hxmemory_manager.h:120
hxattr_noexcept hxsystem_allocator_t hxalignment_t alignment_
Definition hxmemory_manager.h:121
constexpr hxalignment_t hxalignment
hxalignment - The default alignment.
Definition hxmemory_manager.h:67
#define hxattr_nonnull(...)
hxattr_nonnull - Indicates that a function has args that should not be null.
Definition hxsettings.h:106
#define hxattr_nodiscard
hxattr_nodiscard - Indicates the caller should not discard the return value.
Definition hxsettings.h:98
Provides core macros, memory management and feature detection.
#define hxnull
hxnull - The null pointer value for a given pointer type represented by the numeric literal 0.
Definition libhatchet.h:280
ptrdiff_t hxsize_t
hxsize_t - A signed size type, same as ssize_t or ptrdiff_t.
Definition libhatchet.h:207