PDA

View Full Version : Array of Vectors



ToddAtWSU
12th April 2006, 15:12
I am trying to create an array of vectors containing float values. The reason I want this is because I have an enumerated type that will always have x-number of data fields but there can be a growing or shrinking number of rows containing each of those x-fields. So since my columns will never gain or lose columns I want to use an array for this static size but since the rows can grow and shrink I want to use a vector for each column so I can add or delete rows. I have googled around and cannot find if it is possible to create an array of vectors. Thanks for your help!

jacek
12th April 2006, 15:22
std::vector<float> vectors[10];

ToddAtWSU
12th April 2006, 15:25
It's that simple? So then all the vectors will be of type float? Thanks!

ToddAtWSU
12th April 2006, 15:44
How would I go about setting this as a private member of a class in a .h file? Would I just say:


vector<float> vectors[]

Thanks again!