libhatchet
Loading...
Searching...
No Matches
hxallocator< T, hxallocator_dynamic_capacity > Class Template Reference

#include <hxallocator.hpp>

Public Types

using value_t = T

Public Member Functions

 hxallocator (void)
 ~hxallocator (void)
hxsize_t capacity (void) const
const T * data (void) const
T * data (void)
void reserve_storage (hxsize_t size_, hxsystem_allocator_t allocator_=hxsystem_allocator_current, hxalignment_t alignment_=hxalignment)

Detailed Description

template<typename T>
class hxallocator< T, hxallocator_dynamic_capacity >

hxallocator<0> - Capacity is set by first call to reserve_storage and may not be extended.

May be moved using hxswap_memcpy.

Member Typedef Documentation

◆ value_t

template<typename T>
using hxallocator< T, hxallocator_dynamic_capacity >::value_t = T

value_t - Publishes the value type.

Constructor & Destructor Documentation

◆ hxallocator()

template<typename T>
hxallocator< T, hxallocator_dynamic_capacity >::hxallocator ( void )
inline

Does not allocate until reserve_storage is called.

◆ ~hxallocator()

template<typename T>
hxallocator< T, hxallocator_dynamic_capacity >::~hxallocator ( void )
inline

Calls hxfree with any allocated memory.

Member Function Documentation

◆ capacity()

template<typename T>
hxsize_t hxallocator< T, hxallocator_dynamic_capacity >::capacity ( void ) const
inline

Returns the number of elements of T allocated.

◆ data() [1/2]

template<typename T>
T * hxallocator< T, hxallocator_dynamic_capacity >::data ( void )
inline

Returns a pointer to a potentially uninitialized array of T.

◆ data() [2/2]

template<typename T>
const T * hxallocator< T, hxallocator_dynamic_capacity >::data ( void ) const
inline

Returns a pointer to a const and potentially uninitialized array of T.

◆ reserve_storage()

template<typename T>
void hxallocator< T, hxallocator_dynamic_capacity >::reserve_storage ( hxsize_t size_,
hxsystem_allocator_t allocator_ = hxsystem_allocator_current,
hxalignment_t alignment_ = hxalignment )
inline

Capacity is set by first call to reserve_storage and may not be modified.

  • size : The number of elements of type T to allocate space for.
  • allocator : The memory manager ID to use for allocation (default: hxsystem_allocator_current)
  • alignment : The alignment to use for the allocation. (default: hxalignment)

The documentation for this class was generated from the following file: