sead::AnyDelegate class

A type-erased delegate that can store either a Delegate or a LambdaDelegate without heap allocations.

Base classes

template<typename Interface, typename AnyClass, size_t StorageSize>
class AnyDelegateImpl<IDelegate, AnyDelegate, sizeof(Delegate<detail::DummyClassForDelegate>)>

Public types

class UnbindDummy
using Base = AnyDelegateImpl

Constructors, destructors, conversion operators

operator bool() const explicit
Checks if a non-dummy function is stored.

Public functions

auto operator()(Args && ... args) -> auto
Calls the stored function.
auto operator()(Args && ... args) const -> auto
Calls the stored function.
auto getDelegate() -> IDelegate*
auto getDelegate() const -> const IDelegate*

Protected types

using Interface_ = IDelegate

Protected variables

std::aligned_storage_t<StorageSize, alignof(IDelegate)> mStorage