This is kind of a general question about for loops, something I've never had the chance to test.
Lets say we have a for loop like this:
for (int i; i < b->children.size(); i++)
where b is a pointer and children is a vector. If in that for loop I were to change what b points to, would it update b in the next loop? Or would it use b's previous value?
For example, lets say when the for loop starts b points to a node with a children vector of size 5. Then somewhere in the for loop I move that pointer to a node with a children vector of size 3. Which b would it use to compare?
Which b would it use to compare?
There aren't suddenly two b's. The size() method is evaluated every time the loop reiterates - if the size suddenly changes, or b suddenly points to something else, it will affect the execution of the for loop accordingly.