template class EE::SmallFunction¶
Copyable type-erased void callable with inline storage and a heap fallback.
This intentionally implements only the signature used by the scene scheduler. Ordinary lambdas stay inside the object; unusually large or over-aligned callables retain std::function-like fallback behavior.
#include <small_function.hpp> template <std::size_t InlineSize = 64> class SmallFunction { public: // structs struct VTable; // construction SmallFunction(); SmallFunction(std::nullptr_t); SmallFunction(const SmallFunction& other); SmallFunction(SmallFunction&& other); template <typename Callable, typename Decayed = std::decay_t<Callable>, std::enable_if_t<!std::is_same_v<Decayed, SmallFunction>&&std::is_invocable_r_v<void, Decayed&>, int> = 0> SmallFunction(Callable&& callable); ~SmallFunction(); // methods SmallFunction& operator=(const SmallFunction& other); SmallFunction& operator=(SmallFunction&& other); template <typename Callable, typename Decayed = std::decay_t<Callable>, std::enable_if_t<!std::is_same_v<Decayed, SmallFunction>&&std::is_invocable_r_v<void, Decayed&>, int> = 0> SmallFunction& operator=(Callable&& callable); SmallFunction& operator=(std::nullptr_t); operator bool() const; void operator()() const; void reset(); static constexpr std::size_t inlineSize(); };