KiCad PCB EDA Suite
Loading...
Searching...
No Matches
INPLACE_FUNCTION< Sig, Capacity > Class Template Reference

A std::function-style callable wrapper that stores the target in a fixed inline buffer and never allocates on the heap. More...

Detailed Description

template<typename Sig, std::size_t Capacity = 4 * sizeof( void* )>
class INPLACE_FUNCTION< Sig, Capacity >

A std::function-style callable wrapper that stores the target in a fixed inline buffer and never allocates on the heap.

std::function heap-allocates whenever the callable exceeds its small-buffer size (~16 bytes on libstdc++), which dominates hot paths that build a short-lived closure per call. INPLACE_FUNCTION keeps the closure inline, trading a compile-time size cap for the elimination of those allocations.

The stored callable must be nothrow-move-constructible and no larger than Capacity bytes; either violation is a compile error.

Definition at line 42 of file inplace_function.h.


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