2021
11-16
11-16
C++ vector 遍历的几种方法
目录1.迭代器2.C++11新增关键字auto3.数组遍历法4.基于范围的for循环C++vector遍历demo,多种姿势任你选~1.迭代器for(vector<int>::iteratorit=obj.begin();it!=obj.end();it++){cout<<*it<<",";}2.C++11新增关键字autofor(autoit=obj.begin();it!=obj.end();it++){cout<<*it<<",";}3.数组遍历法for(inti=0;i<obj.size();i++){cout<<obj[i]<<"...
继续阅读 >