X
xz
What if I want the following:
vector<int> v;
// v is loaded by push_back()
switch( v.size() ) {
case 2:
//do something
case 4:
//somehow delete two element
//and then do the same thing as in case 2
case 6:
//somehow delete two element
//and then do the same thing as in case 4
default:
//...
}
I thought using "continue" to implement this but got this:
continue statement not within a loop
vector<int> v;
// v is loaded by push_back()
switch( v.size() ) {
case 2:
//do something
case 4:
//somehow delete two element
//and then do the same thing as in case 2
case 6:
//somehow delete two element
//and then do the same thing as in case 4
default:
//...
}
I thought using "continue" to implement this but got this:
continue statement not within a loop