所以,我有以下内容:
std::vector< std::vector <int> > fog;
我很幼稚地初始化它,就像这样:
for(int i=0; i<A_NUMBER; i++)
{
std::vector <int> fogRow;
for(int j=0; j<OTHER_NUMBER; j++)
{
fogRow.push_back(0);
}
fog.push_back(fogRow);
}
感觉这样很不对... 有没有其他方式可以像这样初始化一个向量?
std::vector<int>::max_size()
更多的空间,我会建议您使用一维向量实现二维向量。这里 - andre