Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

delete map elements while iterating cpp

for (auto it = m.cbegin(), next_it = it; it != m.cend(); it = next_it)
{
  ++next_it;
  if (must_delete)
  {
    m.erase(it);
  }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #delete #map #elements #iterating #cpp
ADD COMMENT
Topic
Name
5+3 =