Python has an interesting for statement which lets you specify an else clause.
for
else
In a construct like this one:
for i in foo: if
Something like:
auto it = foo.begin(), end = foo.end(); while ( it != end && ! bar( *it ) ) { ++ it; } if ( it != foo.end() ) { baz(); }
should do the trick, and it avoids the unstructured break.
break