Define COAL_MAKE_ALLOCA_TYPED_PTR

Define Documentation

COAL_MAKE_ALLOCA_TYPED_PTR(Type, Name, Size)

Macro to create a pointer of type Type, with Size * sizeof(Type) allocated elements, refered to by variable Name.

If Size * sizeof(Type) <= COAL_ALLOCA_MAX_STACK_BYTES, the buffer is allocated on the stack via alloca (zero overhead, freed on function return). Otherwise a heap buffer is allocated and owned by a std::unique_ptr that is freed when it goes out of scope.