When declaring a 2d vector, is the space between the last two >'s required?
Or is this fine?Code:vector<vector<int> > v;
I heard that the extra space is required, but I'm not sure.Code:vector<vector<int>> v;
When declaring a 2d vector, is the space between the last two >'s required?
Or is this fine?Code:vector<vector<int> > v;
I heard that the extra space is required, but I'm not sure.Code:vector<vector<int>> v;
If you don't put a space between the two >'s the compiler may interpret it as the >> character ( think cin >> x; ) and it won't compile.
When I use this kind of construct, I usually doThe extra space on both sides helps me see it more clearly. However,Code:vector< vector<int> >;
is just as correct (but asymmetrical and ugly in my opinion).Code:vector<vector<int> >;
abachler: "A great programmer never stops optimizing a piece of code until it consists of nothing but preprocessor directives and comments "
Compilers will start allowing you to skip the space soon, the change will be in the next standard. Until then, it is required.