Quantcast
Channel: Iterating a changing container - Stack Overflow
Browsing latest articles
Browse All 4 View Live

Answer by Arun for Iterating a changing container

The operations which mutate the set structure are insert() and erase(). While iterating, consider using the iterator returned by the mutating operations.it = myset.erase( it...

View Article


Answer by Sergey Kalinichenko for Iterating a changing container

There is a way to do it in two steps: first, go through the original set, and make a set of action items. Then go through the set of action items, and apply them to the original set.An action item is a...

View Article


Answer by sehe for Iterating a changing container

Two basic approaches come to mind:use a task based approach (with the collection locked, push tasks onto a queue for each element, then release all parties to do work and wait till completion). You'll...

View Article

Iterating a changing container

I am iterating over a set of callback functions. Functions are called during iteration and may lead to drastic changes to the actual container of the functions set.What I am doing now is:make a copy of...

View Article
Browsing latest articles
Browse All 4 View Live


Latest Images