Tuesday, July 14, 2009

How do you declare an array of vectors in c++?

How do you declare an array of vectors in c++?

How do you declare an array of vectors in c++?
Actually, I think that this will do the trick:





vector%26lt;string%26gt; a_vStr[10];
Reply:"Array" and "vector" are the same thing. If you mean STL vector, it can be so:


typedef vector %26lt;int%26gt; int_vec;


typedef vector %26lt;int_vec%26gt; int_vec2;


This way, int_vec2 is vector of vectors, or array of vectors.


No comments:

Post a Comment