我想知道是否可以std::vector<std::vector<int>> 通过迭代器访问元素:我无法理解为什么这不能编译:
#include<vector> \n#include<iostream> \n\nstd::vector<std::vector<int>> vec {{1,2},{3,4}} ; \n\n// to access the single vector \nauto it = vec.begin() ; \n\n// to access the element of the vector \nauto iit = it.begin() ; \n\nRun Code Online (Sandbox Code Playgroud)\n这是我得到的错误:
\nprova.cpp: In function \xe2\x80\x98int main()\xe2\x80\x99:\nprova.cpp:10:15: error: \xe2\x80\x98class __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int> > >\xe2\x80\x99 has no member named \xe2\x80\x98begin\xe2\x80\x99\n 10 | auto iit = it.begin() ;\nRun Code Online (Sandbox Code Playgroud)\n