【发布时间】:2021-04-16 15:07:46
【问题描述】:
我想将我的班级与模板一起使用。 主要:
int main(void)
{
HexAdapter<vector> foo;
// maybe?
// HexAdapter<vector<Cell>> foo;
return 0;
}
我试过这样的
template <typename T>
class HexAdapter
{
public:
HexAdapter();
private:
T<T<Cell>> hexCells;
};
出于这个原因,通常我像这样使用vector<vector<Cell>> hexCells 但我想使用所有带有随机访问迭代器的 STL 容器。
【问题讨论】:
标签: c++ class oop c++11 templates