Hi, i'm newbie in C++ and I've been trying to do what the title of this thread said but i don't get it :s, I'm trying to do a table something like that:
| field1 | field2 | field3 | field5 |
---------------------------------------------------
| (int) | (float) | (char) | (double) |
| (int) | (float) | (char) | (double) |
.
.
.
| (int) | (float) | (char) | (double) |
where the table isn't static i mean the number of fields are variable (field1, field2...fieldn) and the number of values of every field are either variable of fixed..
To implement that I thought in a vector of vectors :s.. I made a class(named Fields) where a member is for its name and a vector for its values..
And I made another class for contain those fields (named Table), which has, among other members, a vector of Field's..
The problem is that I made the class Fields as template class in order to be able to have a vector of values of any type (as can see above in the table)..
But in the Table class I cannot just declare something like ... "vector<Fields> fields" because I have an error, so I have to type: "vector< Fields<type > >" so I have to declare Table class as template class too, in order I to be able to put in it: "vector< Fields<T> > fields"... but the real problem is when I want to use them.. for explample, if I want to declare a new table I need to do something like: "Table<type> table;" but the problem is that I cannot put a type because the Table must contain diferent data types...
So I hope you can understand me :s.. If so, I hope someone can help me.. Thanks in advanced