Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changes to a container while BOOST_FOREACH is iterating through it?

What would happen if a container that BOOST_FOREACH is iterating through is changed inside the BOOST_FOREACH scope?

Does BOOST_FOREACH "freeze" the initial state?

like image 471
Jonathan Livni Avatar asked Apr 21 '11 11:04

Jonathan Livni


1 Answers

In this case behavior is undefined. Look at Hoisting and Iterator Invalidation in official documentation of BOOST_FOREACH.

like image 150
Mihran Hovsepyan Avatar answered Sep 20 '22 03:09

Mihran Hovsepyan