Add an early out for empty signals

This commit is contained in:
Danny Robson 2012-05-11 12:20:32 +10:00
parent c2c8fea6cc
commit e3072aeedb

View File

@ -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);
}
};
}