util-event: Automatically clear event listeners when destructed

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2019-04-02 19:11:26 +02:00
parent 8e9e39a88e
commit 1b7de8b6b1

View file

@ -30,6 +30,13 @@ namespace util {
std::function<void()> silence_cb; std::function<void()> silence_cb;
public /* functions */: public /* functions */:
// Destructor
inline ~event()
{
this->clear();
}
// Add new listener. // Add new listener.
inline void add(std::function<void(_args...)> listener) inline void add(std::function<void(_args...)> listener)
{ {