ESPHome 2026.4.0-dev
Loading...
Searching...
No Matches
esphome::Callback< X > Struct Template Reference

Lightweight type-erased callback (8 bytes on 32-bit) that avoids std::function overhead. More...

Detailed Description

template<typename... X>
struct esphome::Callback< X >

Lightweight type-erased callback (8 bytes on 32-bit) that avoids std::function overhead.

No null check, no exceptions, no heap allocation for small trivially-copyable callables.

With C++20 if constexpr, automatically detects [this] lambdas (sizeof <= sizeof(void*), trivially copyable) and stores them inline. Larger callables are heap-allocated.

Definition at line 1761 of file helpers.h.


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