Bracing the for makes the stepping go ok but... the the for loop loops forever .. eh eh

If I do not clear _active_dialog the for still loops....
If if do not brace all it loops... it even looped on the return.. go figure...


So finally the only way I could get the orignal code work was to modify the for statement:

for(/**/; iter != _active_dialogs.end() && _active_dialogs.size(); iter++)
if(iter->second == _active_dialog)
_active_dialogs.erase(iter);


.. seems like "_active_dialogs.end() == true" is never reached...
Isn't there an STL rule/feature about iterator consistancy when modifying the same container the iterator is constructed from in a loop?


My guess is that once the iterator is constructed in this case it forgets "the state of the map" and keeping track... performance reasons??

That's all I could figure out (and to get out of the for)

And oh: Why is this hapenning to me ;)


> >* Frederic Bouvier -- Sunday 15 February 2004 23:44: > > > Sorry, but it works for me ( window closes and program runs ). > > > Anybody else seeing what Derick is describing ? > > > >Nope. Works perfectly. (Linux, CVS/HEAD). I'll run valgrind over it ... > > > >m. > > The thing that does not make sense is that the for loop even runs "delete > _active_dialog;" when I step in Debug (MSVC 2003) > > for(/**/; iter != _active_dialogs.end(); iter++) > if(iter->second == _active_dialog) > _active_dialogs.erase(iter); > > delete _active_dialog; > > ------ > Thus it evaluates: > > for(... > if(... > _active... > delete.. > for(... > if(... > _active... > delete.. > > > And that scares me ;) > > Maybe the way MS(VC 2003) handles the STL? or CR/LF ... I'll look into > this...

Hidden braces ? ;-) I must admit I use .Net 2002 but it is hard to think
MSVC is having problem on it. Currently the code is equivalent to this :

    for(/**/; iter != _active_dialogs.end(); iter++) {
        if(iter->second == _active_dialog) {
            _active_dialogs.erase(iter);
        }
    }

delete _active_dialog;

Try to put them and see if it makes a difference.

-Fred

_________________________________________________________________
Find great local high-speed Internet access value at the MSN High-Speed Marketplace. http://click.atdmt.com/AVE/go/onm00200360ave/direct/01/



_______________________________________________ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to