class

MiriDelegate

Module
Miri
Header
#include "Miri/Core/MiriDelegate.h"
Namespace
Miri
Template
template<typename Ret, typename... Args>

Type aliases

AliasDescription
using FunctionType = std::function<Ret(Args...)>

Constructors

SignatureNameDescription
MiriDelegate() = defaultMiriDelegate
MiriDelegate(const MiriDelegate& other)MiriDelegateBindings are owned by a shared block rather than by the delegate itself so a Broadcast can keep walking after a handler destroys the delegate (a button whose click closes the panel that owns it).
MiriDelegate(MiriDelegate&&) noexcept = defaultMiriDelegate
~MiriDelegate()~MiriDelegate

Public functions

ReturnsNameDescription
MiriDelegate&operator=
MiriDelegate&operator=
CDelegateHandleAddThe returned handle is what Remove takes
CDelegateHandleAdd
boolRemove
voidClear
voidBroadcastHandlers may add or remove listeners, destroy the widget that owns this delegate, or close the panel a LATER listener belongs to.
boolIsBound
size_tGetCount
voidoperator()

Function details

MiriDelegate

C++
MiriDelegate() = default

MiriDelegate

C++
MiriDelegate(const MiriDelegate& other)

Bindings are owned by a shared block rather than by the delegate itself so a Broadcast can keep walking after a handler destroys the delegate (a button whose click closes the panel that owns it). A copied delegate must not share that block — it would fire the source's listeners — so copies deep-copy it.

MiriDelegate

C++
MiriDelegate(MiriDelegate&&) noexcept = default

~MiriDelegate

C++
~MiriDelegate()

operator=

C++
MiriDelegate& operator=(const MiriDelegate& other)

operator=

C++
MiriDelegate& operator=(MiriDelegate&&) noexcept = default

Add

C++
CDelegateHandle Add(FunctionType func)

The returned handle is what Remove takes

Add

C++
template<typename T> CDelegateHandle Add(T* obj, Ret (T::*method)(Args...))

Remove

C++
bool Remove(CDelegateHandle handle)

Clear

C++
void Clear()

Broadcast

C++
void Broadcast(Args... args) const

Handlers may add or remove listeners, destroy the widget that owns this delegate, or close the panel a LATER listener belongs to. The walk therefore never touches this after the first call: it pins the shared block, snapshots the handles, and before each call re-resolves the handle against the live list — a listener removed by an earlier handler is skipped rather than run against an object that no longer exists. The functor is copied out before the call because a handler that removes ITSELF would otherwise free the storage it is executing from.

IsBound

C++
bool IsBound() const

GetCount

C++
size_t GetCount() const

operator()

C++
void operator()(Args... args) const
Generated from Miri/Core/MiriDelegate.h via miri.json · Dec 5, 2026Version 1.1.0