File memory.hpp

Functions

template<typename T>
static inline constexpr T *allocateMemory(uint32 numElements, bool init = false)

Allocates memory to be used by an array of a specific size.

Template Parameters:

T – The type of the values stored in the array

Parameters:
  • numElements – The number of elements in the array

  • init – True, if all elements in the array should be default-initialized, false otherwise

Returns:

A pointer to the allocated memory

template<typename T>
static inline constexpr T *reallocateMemory(T *array, uint32 numElements)

Reallocates the memory used by an array in order to resize it.

Template Parameters:

T – The type of the values stored in the array

Parameters:
  • array – A pointer to an array of template type T

  • numElements – The number of elements in the resized array

Returns:

A pointer to the reallocated memory

template<typename T>
static inline constexpr void freeMemory(T *array)

Frees the memory used by an array.

Template Parameters:

T – The type of the values stored in the array

Parameters:

array – A pointer to an array of template type T