I'm iterating through a
for(auto markerCounter = ellipsePropertiesMap.begin(); markerCounter != ellipsePropertiesMap.end(); markerCounter++)
for(auto markerCounter2 = ellipsePropertiesMap.begin(); markerCounter2 != ellipsePropertiesMap.end(); markerCounter2++)
//I also tried the following:
//markerCounter2 = ellipsePropertiesMap.end();
I want stop the inner loop when the condition is met.
break will do that exactly.
Alternatively, you might be able to make that condition part of the loop-condition.
I know that if I call break, it will stop both the loops.
You knew wrong.
This would be valid if and only if
markerCounter2 == ellipsePropertiesMap.begin(). If the condition is satisfied on any other iteration than the first, you increment the iterator past the end and have undefined behaviour. Also, this iterator advancement doesn't break out of the loop body, which will be executed before the loop-condition is checked for the next time.
markerCounter2 = ellipsePropertiesMap.end();
This would dis-satisfy the loop condition, causing the loop to stop at the end of current iteration. However executing
after it would again increment past the end and have UB.