Skip to main content
you can't bold code with stars
Source Link
Kate Gregory
  • 19k
  • 8
  • 60
  • 87

The original code has only one issue:

for(; iter != endIter; *++iter*++iter) { if(Some Condition) { // is it safe ? aMap.erase(*iter++*iter++); } } 

Here the iteriter is incremented once in the for loop and another time in erase, which will probably end up in some infinite loop.

The original code has only one issue:

for(; iter != endIter; *++iter*) { if(Some Condition) { // is it safe ? aMap.erase(*iter++*); } } 

Here the iter is incremented once in the for loop and another time in erase, which will probably end up in some infinite loop.

The original code has only one issue:

for(; iter != endIter; ++iter) { if(Some Condition) { // is it safe ? aMap.erase(iter++); } } 

Here the iter is incremented once in the for loop and another time in erase, which will probably end up in some infinite loop.

The original code has only one issue:

for(; iter != endIter; *++iter*) {   if(Some Condition)   {   // is it safe ?   aMap.erase(*iter++*);   } } 

Here the iter is incremented once in the for loop and another time in erase, which will probably end up in some infinite loop.

The original code has only one issue:

for(; iter != endIter; *++iter*) {   if(Some Condition)   {   // is it safe ?   aMap.erase(*iter++*);   } } 

Here the iter is incremented once in the for loop and another time in erase, which will probably end up in some infinite loop.

The original code has only one issue:

for(; iter != endIter; *++iter*) { if(Some Condition) { // is it safe ? aMap.erase(*iter++*); } } 

Here the iter is incremented once in the for loop and another time in erase, which will probably end up in some infinite loop.

Code Block added
Source Link
Pablo Claus
  • 5.9k
  • 3
  • 31
  • 40

The original code has only one issue:

for(; iter != endIter; *++iter*) { if(Some Condition) { // is it safe ? aMap.erase(*iter++*); } } 

for(; iter != endIter; ++iter) { if(Some Condition) { // is it safe ? aMap.erase(iter++); } } HereHere the iter is incremented once in the for loop and another time in erase, which will probably end up in some infinite loop.

The original code has only one issue:

for(; iter != endIter; ++iter) { if(Some Condition) { // is it safe ? aMap.erase(iter++); } } Here the iter is incremented once in the for loop and another time in erase, which will probably end up in some infinite loop.

The original code has only one issue:

for(; iter != endIter; *++iter*) { if(Some Condition) { // is it safe ? aMap.erase(*iter++*); } } 

Here the iter is incremented once in the for loop and another time in erase, which will probably end up in some infinite loop.

Source Link
Loading