Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- std::multimap<int, std::pair<std::function<...>, bool>> target_subs{};
- //...
- // various insertions and deletions...
- //...
- for (auto sub = begin(target_subs); sub != end(target_subs); ) {
- if (sub->second.second) {
- (sub++)->second.first(evt);
- } else {
- sub->second.first(evt);
- ++sub;
- }
- }
- size_t valid_passes{0};
- for (auto sub = begin(target_subs); sub != end(target_subs); ) {
- if (sub->second.second) {
- (sub++)->second.first(evt);
- if (target_subs.size() < valid_passes) { break; } // Not very useful...
- // possible to erase all elements and insert the same number back in
- } else {
- sub->second.first(evt);
- ++sub;
- }
- ++valid_passes;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement