Add an early out for empty signals
This commit is contained in:
parent
c2c8fea6cc
commit
e3072aeedb
11
signal.hpp
11
signal.hpp
@ -106,16 +106,19 @@ namespace util {
|
||||
|
||||
/// Execute all callbacks, ignoring the return parameters. Does not combine results.
|
||||
void operator () (Args... tail) {
|
||||
auto i = m_children.cbegin ();
|
||||
bool looping = m_children.cend () != i;
|
||||
if (m_children.empty ())
|
||||
return;
|
||||
|
||||
while (looping) {
|
||||
auto i = m_children.cbegin ();
|
||||
bool looping;
|
||||
|
||||
do {
|
||||
// Increment before we execute so that the caller is able to deregister during execution.
|
||||
auto current = i++;
|
||||
looping = m_children.cend () != i;
|
||||
|
||||
(*current)(tail...);
|
||||
}
|
||||
} while (looping);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user