Possible Duplicate:
Is it possible to declare two variables of different types in a for loop?
Consider this code:
for( std::vector<std::string>::iterator it = myVec.begin(), int i = 3; it < myVec.end(); it++, i++ )
{
// some operations with the vector
}
I got very surprised that MSVC 2010 gave me errors compiling this for loop. Is using comma operator forbidden by MSVS?
Here is an error:
error C2062: type 'int' unexpected
error C2143: syntax error: missing ';' before ')'
If I try to push the "int i" definition out of the loop, I get:
error C2440: 'initializing': cannot convert from 'int' to 'std::vector'