while (true)
if (begIt == endIt){ // We must have not found an equal member
// So do these statements
break;
}
if ((*begIt).member == someObject.member){
// Do these statements
break;
}
++begIt;
}
// someLabel: ...
The only solution I would accept in my code. (or seperate function. directly executing a lambda for this is ugly...)
But it is very likely that you are worrying about the wrong things. Inserting a goto will probably not increase performance because the thing that you are intending to "optimize away" is a single conditional (pointer == pointer) which is negligible in 99.9999999% of all programs out there. So even if you are writing high-performance numerical code I would advice you to simple break and check with an if after the loop (I dare you to show me some profiler output to prove me wrong ;)
)