我正在尝试打印 3D vector 但面临运算符不匹配的问题。这就是我填充 vector 的方式
masterList.push_back(tokens)
我试过这段代码:
copy(masterList.begin(), masterList.end(), ostream_iterator<string>(cout, "\n"));
外观:
for( vector<vector<vector<string>>>::const_iterator i = masterList.begin(); i != masterList.end(); ++i)
cout<<*i<<' ';
最新的cout
不打印 3D vector 元素的指针。
最佳答案
它只是不知道如何打印*i
元素(类型为 vector<vector<string>>
)。您还需要两个内部循环来打印每个字符串元素。
关于c++ - 打印 3D vector ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17079146/