28 using Token = std::shared_ptr<void>;
42 template <
typename Broadcaster,
typename F>
45 return subscribe<traits::MaybeDereferencedType<Broadcaster>, Signature>(
utils::maybeDeref(broadcaster),
59 template <
typename Broadcaster,
typename Signature,
typename F>
62 t.push_back(broadcaster.template station<Signature>().registerListener(std::forward<F>(f)));
77 t.erase(std::ranges::find(t, ts));
78 assert(ts.unique() &&
"The given token has external references");
Contains stl-like type traits.
Helper for dune-functions.
Definition: assemblermanipulatorbuildingblocks.hh:22
decltype(auto) maybeDeref(T &t)
if T is a pointer type, return the dereferenced value, otherwise return the value itself.
Definition: functionhelper.hh:118
Definition: broadcaster.hh:17
Definition: listener.hh:27
void unSubscribeAll()
Unsubscribe from all listeners. At the moment unsubscribing can't be done more granularly.
Definition: listener.hh:69
auto subscribe(Broadcaster &broadcaster, F &&f)
Function to subscribe to a broadcaster with a given function (either a lambda, std::function or funct...
Definition: listener.hh:43
void unSubscribeLast()
Unsubscribe from the last subscribed listener.
Definition: listener.hh:74
void unSubscribe(Token &&ts)
Definition: listener.hh:76
auto subscribe(Broadcaster &broadcaster, F &&f)
Function to subscribe to a broadcaster with a given function (either a lambda, std::function or funct...
Definition: listener.hh:61
std::shared_ptr< void > Token
Definition: listener.hh:28
Type trait for extracting information about functions.
Definition: traits.hh:371
Definition: utils/concepts.hh:631