Hi dee Ho again people!
I have a lil problem. I'm trying to do a vector containing vectors... And in case some of you visit multiple boards as I do, yes I did this same post on one another board... Reason is that I need to solve the problem. asap.
Well, basically there's no problem, but... I do not know how many vectors the vector containing vectors will contain
Problem is that I do not have those vectors already created, so I should first create right amount of vectors inside a vector, before starting to feed values in them.
I tried following:
Code:
vector< vector<string> > mainvector;
vector<string> *col_na = new vector<string>[ncols];
//I tried to do an array of string type vectors first, and there the ncols is int type variable telling how many of those I need.
for(i=0;i<ncols;i++)
{
mainvector.push_back(*(col_na+i));
}
// there the mainvector should now contain those other vectors.
This compiles ok with -Wall flag, but when I run it only thing happens is
matti@linux:~> ./test
Aborted
matti@linux:~>
Any ideas how to do this? Is there a way to use something stored in a stringvariable as a name for those vectors I wish to store inside the mainvector, instead of using array of pointers?