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
1 changed files with 7 additions and 0 deletions

View File

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