FixedFunction<Signature, Capacity> - a move-only callable wrapper with inline storage that never touches the heap. More...
#include <cstddef>#include <new>#include <type_traits>#include <utility>Go to the source code of this file.
Classes | |
| class | pulp::runtime::FixedFunction< R(Args...), Capacity, Alignment > |
Namespaces | |
| namespace | pulp |
| namespace | pulp::runtime |
FixedFunction<Signature, Capacity> - a move-only callable wrapper with inline storage that never touches the heap.
std::function may allocate when it is constructed or copied and requires a copyable target, so it does not belong on a realtime path. FixedFunction stores the target inside the object. A target that does not fit is a compile error, not a silent allocation, so a realtime queue of callables stays allocation-free by construction.
Contract:
The target is destroyed with the wrapper, so destroying a FixedFunction on the audio thread runs the target's destructor there. Capture trivially destructible state (pointers, numbers) for objects that live on the audio thread.