While using std::for_each algorithm how do I break when a certain condition is satisfied?
You can use find_if algorithm, which will stop and return the iterator where the predicate condition applied to the iterated element returns true. So your predicate should be changed to return a boolean as the continue/break condition.
However, this is a hack, so you can use the algorithms.
Another way is to use BOOST_FOREACH.