Lightweight non-allocating delegate wrapper with 32-byte Small Buffer Optimization (SBO). Eliminates std::function heap allocations and virtual table overhead for event handlers.
More...
|
| | EventHandlerDelegate () noexcept=default |
| |
| | EventHandlerDelegate (const EventHandlerDelegate &)=delete |
| |
| | EventHandlerDelegate (EventHandlerDelegate &&rhs) noexcept |
| |
| template<typename Handler , typename Decayed = std::decay_t<Handler>, typename = std::enable_if_t< !std::is_same_v<Decayed, EventHandlerDelegate> && std::is_invocable_r_v<void, Decayed&, const EventType&> >> |
| | EventHandlerDelegate (Handler &&handler) |
| | Construct delegate wrapping a callable object (lambda, function pointer, or functor).
|
| |
| | EventHandlerDelegate (void *srcObj, void(*stub)(void *instance, const EventType &event), void(*moveFn)(void *destStorage, void *&destInstance, void *&srcInstance) noexcept, void(*destroyFn)(void *instance) noexcept) noexcept |
| | Construct delegate from type-erased thunk operations.
|
| |
| void | invoke (const EventType &event) const |
| | Invoke wrapped handler directly with concrete event.
|
| |
| | operator bool () const noexcept |
| | Check if delegate wraps a valid handler.
|
| |
| void | operator() (const EventType &event) const |
| | Function call operator for callable ergonomics.
|
| |
| EventHandlerDelegate & | operator= (const EventHandlerDelegate &)=delete |
| |
| EventHandlerDelegate & | operator= (EventHandlerDelegate &&rhs) noexcept |
| |
| void | reset () noexcept |
| | Reset delegate to empty state.
|
| |
| | ~EventHandlerDelegate () |
| |
template<typename EventType, std::size_t InlineSize = 32>
class corium::internal::EventHandlerDelegate< EventType, InlineSize >
Lightweight non-allocating delegate wrapper with 32-byte Small Buffer Optimization (SBO). Eliminates std::function heap allocations and virtual table overhead for event handlers.
- Template Parameters
-
| EventType | The concrete event type invoked by this delegate. |
template<typename EventType , std::size_t InlineSize = 32>
template<typename Handler , typename Decayed = std::decay_t<Handler>, typename = std::enable_if_t< !std::is_same_v<Decayed, EventHandlerDelegate> && std::is_invocable_r_v<void, Decayed&, const EventType&> >>
Construct delegate wrapping a callable object (lambda, function pointer, or functor).
- Template Parameters
-
- Parameters
-
| handler | Callable instance. |