Raven Engine v0.1
Loading...
Searching...
No Matches
Raven::AllocatorTraits< T > Struct Template Reference

Compile-time traits for determining allocation strategy of T. More...

#include <AllocatorTraits.h>

Static Public Attributes

static constexpr bool UseStack = sizeof(T) <= 32 && alignof(T) <= alignof(max_align)
 True if T can be safely allocated on the stack.
static constexpr bool UsePool = !UseStack && sizeof(T) > 32
 True if T should be allocated from a memory pool.

Detailed Description

template<typename T>
struct Raven::AllocatorTraits< T >

Compile-time traits for determining allocation strategy of T.

Determines whether instances of type T should be allocated on the stack (for small, properly aligned types) or from a pool (for larger types).

Template Parameters
TThe type to evaluate.

Member Data Documentation

◆ UsePool

template<typename T>
bool Raven::AllocatorTraits< T >::UsePool = !UseStack && sizeof(T) > 32
staticconstexpr

True if T should be allocated from a memory pool.

Evaluates to true when UseStack is false and sizeof(T) > 32.

◆ UseStack

template<typename T>
bool Raven::AllocatorTraits< T >::UseStack = sizeof(T) <= 32 && alignof(T) <= alignof(max_align)
staticconstexpr

True if T can be safely allocated on the stack.

Evaluates to true when sizeof(T) <= 32 and alignment of T does not exceed the maximum fundamental alignment.


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