In article <01db3ce8-2e5e-470d-a892-
0e**********@b1 g2000hsg.google groups.com>,
zh*********@gma il.com says...
[ ... ]
well, I gave a case not so tough, what if a case a little tougher?
vector<intv;
// 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 *four* element
//and then do the same thing as in case 2
default:
//...
}
i.e. I want to go to case 2 both after I treat the case 4 and case 6.
Truth to tell, I doubt I'd use switch at all for this. Rather, I'd do
something like this:
if (x == 2 || x == 4 || x == 6) {
v.erase(v.begin ()+2, v.begin()+x-2);
// do something
}
else
// whatever was in your default.
Of course, you'll probably need to make minor changes to account for the
position in the vector where you want to do the deletion.
--
Later,
Jerry.
The universe is a figment of its own imagination.