- if (m_match == MATCH_ANY) {
- // Each Delegate in the condition MUST match an embedded Delegate.
- for (vector<Delegate*>::const_iterator d1 = dels.begin(); d1 != dels.end(); ++d1) {
- if (find_if(m_delegates.begin(), m_delegates.end(), _isSameDelegate(*d1)) == m_delegates.end())
+
+ if (!m_delegates.empty()) {
+ if (m_match == MATCH_ANY) {
+ // Each Delegate in the condition MUST match an embedded Delegate.
+ for (vector<Delegate*>::const_iterator d1 = dels.begin(); d1 != dels.end(); ++d1) {
+ if (find_if(m_delegates.begin(), m_delegates.end(), _isSameDelegate(*d1)) == m_delegates.end())
+ return false;
+ }
+ }
+ else if (m_match == MATCH_OLDEST) {
+ if (search(dels.begin(), dels.end(), m_delegates.begin(), m_delegates.end(), _isSameDelegate()) != dels.begin())
+ return false;
+ }
+ else if (m_match == MATCH_NEWEST) {
+ if (search(dels.rbegin(), dels.rend(), m_delegates.begin(), m_delegates.end(), _isSameDelegate()) != dels.rbegin())