Consider a case of a for inside an other for
int f( ... )
{
for (int i = start_a; i < end_a; i++)
{
for (int j = start_b; j < end_b; j++)
{
// make some computation
if( i_must_exit == true)
{
// exit from all for
}
}
}
// I want arrive here
}
We want to break from both for
loops. This isn't easy in C++03 without factoring out the inner function, throwing an exception, etc. I was wondering if C++11 introduced a mechanism by which to do this.