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.
|
/// Execute all callbacks, ignoring the return parameters. Does not combine results.
|
||||||
void operator () (Args... tail) {
|
void operator () (Args... tail) {
|
||||||
auto i = m_children.cbegin ();
|
if (m_children.empty ())
|
||||||
bool looping = m_children.cend () != i;
|
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.
|
// Increment before we execute so that the caller is able to deregister during execution.
|
||||||
auto current = i++;
|
auto current = i++;
|
||||||
looping = m_children.cend () != i;
|
looping = m_children.cend () != i;
|
||||||
|
|
||||||
(*current)(tail...);
|
(*current)(tail...);
|
||||||
}
|
} while (looping);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user