-
July 13th, 2010, 08:36 AM
#1
vectors of vectors of different types...
Hi,
So my problem is that I need to create a data table in which each column is a vector that contains some sort of data that is read in from a file. The problem is that the table could have any dimensions, and each column can be one of many types (string, int, double, etc.). I would like to know if there is a way to create this object that I want. Right now I am attempting to do it using a template class:
Code:
template <typename T2>
class asciiColumn
{
vector<T2> vec;
public:
asciiColumn(vector<T2>);
vector<T2> read();
asciiColumn (vector<T2> invec)
{
vec = invec;
}
asciiColumn() {}
vector<T2> read()
{
return vec;
}
};
The problem with this is that to instantiate a vector of asciiColumns I have to specify the type that asciiColumn should contain, and that defeats the purpose.
Any help with this solution or other proposed solutions would be much appreciated.
Thanks, Tommy
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|