C++ 标准模板库(STL)——迭代器(iterators)的用法及理解
2021-07-24 00:55
阅读:759
标签:模板库 mes include start turn begin pre 理解 ace
C++ STL中迭代器(iterators)用于遍历对象集合的元素。这些集合可能是容器,也可能是容器的子集。
举例:(1)set的遍历:
#include#includeset> using namespace std; int main() { setint> int_set; for (int i = 0; i 5; i++) { int_set.insert(i); } for (auto start = int_set.begin(); start != int_set.end(); start++) { cout endl; }return 0; }
(2)map的遍历:
#include#include
C++ 标准模板库(STL)——迭代器(iterators)的用法及理解
标签:模板库 mes include start turn begin pre 理解 ace
原文地址:https://www.cnblogs.com/JCpeng/p/15001728.html
文章来自:搜素材网的编程语言模块,转载请注明文章出处。
文章标题:C++ 标准模板库(STL)——迭代器(iterators)的用法及理解
文章链接:http://soscw.com/essay/106884.html
文章标题:C++ 标准模板库(STL)——迭代器(iterators)的用法及理解
文章链接:http://soscw.com/essay/106884.html
评论
亲,登录后才可以留言!