Let's say I have the following loop:
vector <string> args; for (string s : args) { if ( s == "condition" ) continue; // skips to next iteration }
How can I skip multiple iterations in this case? Is there something like multiple continuation statements?
Consider using a loop for with an index:
for
for (size_t i = 0; i < args.size(); i++) { if (args[i] == "condition") { i++; continue; } }
You can use an iterator.
auto it_end = --args.end(); for(auto it = args.begin(); it != args.end(); it++){ if ( *it == "condition" && it != it_end) it++; }