12#if HX_USE_MACROS_WITH_MODULE
13#error Header does not provide macros alone.
24template<
typename T_, hx
size_t fixed_capacity_>
36#if (HX_HARDENING_MODE) == HX_HARDENING_MODE_DEBUG
37 ::memset(m_data_, 0xab,
sizeof m_data_);
66 alignas(T_)
unsigned char m_data_[fixed_capacity_ *
hxsizeof<T_>()];
111 if(size_ == m_capacity_) {
115 m_data_ =
static_cast<T_*
>(
void reserve_storage(hxsize_t size_, hxsystem_allocator_t allocator_=hxsystem_allocator_current, hxalignment_t alignment_=hxalignment)
Capacity is set by first call to reserve_storage and may not be modified.
Definition hxallocator.hpp:108
T * data(void)
Returns a pointer to a potentially uninitialized array of T.
Definition hxallocator.hpp:99
const T * data(void) const
Returns a pointer to a const and potentially uninitialized array of T.
Definition hxallocator.hpp:96
T value_t
value_t - Publishes the value type.
Definition hxallocator.hpp:75
hxallocator(void)
Does not allocate until reserve_storage is called.
Definition hxallocator.hpp:78
hxsize_t capacity(void) const
Returns the number of elements of T allocated.
Definition hxallocator.hpp:93
~hxallocator(void)
Calls hxfree with any allocated memory.
Definition hxallocator.hpp:84
hxallocator<1+> - Provides static allocation when capacity is greater than zero.
Definition hxallocator.hpp:25
hxallocator(void)
Initializes memory to 0xab when HX_HARDENING_MODE == HX_HARDENING_MODE_DEBUG.
Definition hxallocator.hpp:35
const T * data(void) const
Returns a pointer to a const and potentially uninitialized array of T.
Definition hxallocator.hpp:45
T value_t
value_t - Publishes the value type.
Definition hxallocator.hpp:28
void reserve_storage(hxsize_t size_, hxsystem_allocator_t allocator_=hxsystem_allocator_current, hxalignment_t alignment_=hxalignment)
Ensures capacity.
Definition hxallocator.hpp:55
hxsize_t capacity(void) const
Returns the number of elements of T allocated.
Definition hxallocator.hpp:42
T * data(void)
Returns a pointer to a potentially uninitialized array of T.
Definition hxallocator.hpp:48
HX_NS_BEGIN_ constexpr hxsize_t hxallocator_dynamic_capacity
hxallocator_dynamic_capacity - A capacity value that allows for dynamic allocation.
Definition hxallocator.hpp:20
@ 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
void hxfree(void *ptr_) hxattr_noexcept hxattr_hot
hxfree - Frees memory previously allocated with hxmalloc or hxmalloc_ext.
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 hxinline
hxinline - Force a function to be inlined into its callers.
Definition hxsettings.h:125
#define hxinline_constexpr
hxinline_constexpr - Enables C++17 compatable "inline constexpr" usage for variables so they can be e...
Definition hxsettings.h:275
#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
constexpr hxsize_t hxsizeof(void)
hxsizeof - Returns the size of a type or expression as hxsize_t.
Definition libhatchet.h:294
#define hxassert_always(x_,...)
hxassert_always(bool x, ...) - Logs an error and terminates execution if x is false.
Definition libhatchet.h:121
ptrdiff_t hxsize_t
hxsize_t - A signed size type, same as ssize_t or ptrdiff_t.
Definition libhatchet.h:207