I'm calling a capture-by-reference lambda and returning from it under certain conditions to skip evaluation of the second if statement, which may or may not be true but should not be evaluated under certain circumstances. I still need the second if to execute regardless of if the first executes, except in the case where I return of course. I can't return from the entire enclosing function because I have code after the lambda and after the else that should still execute.
My question is, since this seems like poor design, is there a better alternative? This seems like the easiest way to do it, but I think there should be a better way.
Eventually this will be refactored and abstracted anyway, but I'm getting the rough outline of how it should work down first before abstracting it to be more modular.
EDIT: and by 'better solution', I mean 'without abusing lambdas' - you could get arrested for that.
By 'better solution' I meant 'without abusing lambdas', I should have clarified. Also I can't understand how your solution does the same thing as mine? It looks like you're evaluating if #2 every iteration of the loop, which will definitely cause problems.