虽然你的问题是not非常清楚,我假设您的意思是 2D 向量表示向量的向量:
vector< vector<int> > vvi;
然后你需要使用两个迭代器来遍历它,第一个是“行”的迭代器,第二个是该“行”中“列”的迭代器:
//assuming you have a "2D" vector vvi (vector of vector of int's)
vector< vector<int> >::iterator row;
vector<int>::iterator col;
for (row = vvi.begin(); row != vvi.end(); row++) {
for (col = row->begin(); col != row->end(); col++) {
// do stuff ...
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)