mardi 27 janvier 2015

Container of Miscellaneous Types - C++

So I'm trying to create a "Table" class in C++ with a structure like so:


Table.h



class Table
{
private:
class TableImpl;
TableImpl* impl;
};


Table.cpp



class Table::TableImpl
{
private:
class Row
{
private:
template <typename T>
class RowDataCell
{
T data;
}
std::vector<RowDataCell*> data;
};
std::vector<Row*> rows;
};


The TableImpl consists of a std::vector of Row objects, and each Row object consists of a std::vector of generic RowDataCell objects. The only thing is, I can't create the std::vector because I need to provide a template argument for RowDataCell*, which will stymie my goals ofhaving a container of miscellaneous objects.


Is there a way using standard C++ that I can accomplish this goal.


Aucun commentaire:

Enregistrer un commentaire