4
我在向量中嵌套向量的问题,相当于在C中的二维数组。我尝试了代码演示这张贴在众多的网站,无济于事。错误嵌套向量<>向量<>
class Board
{
public:
vector< vector<Cell> > boardVect; //Decalre the parent vector as a memebr of the Board class
Board()
{
boardVect(3, vector<Cell>(3)); //Populate the vector with 3 sets of cell vectors, which contain 3 cells each, effectivly creating a 3x3 grid.
}
};
当我尝试编译,我收到此错误:
F:\ main.cpp中| 52 |错误:不对应的呼叫“(标准::矢量>)(INT,STD ::向量)”
52号线:boardVect(3, vector<Cell>(3));
与3矢量类构建亲代载体时,我得到一个错误的错误?
是的,那是我的问题,谢谢!我正在使用初始化列表;但我记得用于创建对象的非构造函数。 – dymk 2011-05-14 01:22:38