stackBuffer

Returns a structure to your stack that contains a buffer of bytes size. Memory is allocated by calling .alloc!T(count) on it in order to get count elements of type T. The return value will be a RAII structure that releases the memory back to the stack buffer upon destruction, so it can be reused. The pointer within that RAII structure is aligned to T.alignof. If the internal buffer isn't enough to fulfill the request including padding from alignment, then malloc() is used instead.

Warning: Always keep the return value of .alloc() around on your stack until you are done with its contents. Never pass it directly into functions as arguments!

@trusted pure
stackBuffer
(
size_t bytes
)
()

Parameters

bytes

The size of the buffer on the stack.

Return Value

Type: auto

A stack buffer allocator.

Meta