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. /// 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);
} }
}; };
} }