Skip to content

function call_with_temp(size_t, Fn &&) memory

template <size_t stack_size = 4096, typename T = u8, typename Fn>
KFR_INLINE static void call_with_temp(size_t temp_size, Fn&& fn)

Calls a function with a temporary buffer, allocated on the stack if small enough, otherwise on the heap.

Template parameters
stack_size Maximum size to use stack allocation (in elements).
T Type of temporary buffer elements (default: u8).
Fn Callable type.
Parameters
temp_size Number of elements requested.
fn Function to call with a pointer to the buffer.

Defined at meta/memory.hpp:343