目前我已经开始使用auto关键字.我对此有一些疑问:
如果我需要遍历vector我:
vector<int>v;
for(auto it : v){
cout << it <<endl;
}
Run Code Online (Sandbox Code Playgroud)
但是假设我需要做以下事情:
vector<int>v;
for(auto it:v){
for(auto jt:X){
//where X is next position of it's position
//What I mean is if it is currently at 2nd position then
//jt iterator will start from 3rd position
}
}
Run Code Online (Sandbox Code Playgroud)
我完全不知道该怎么做.请建议适当的方法.提前谢谢.