惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
SecWiki News
SecWiki News
酷 壳 – CoolShell
酷 壳 – CoolShell
爱范儿
爱范儿
量子位
M
MIT News - Artificial intelligence
GbyAI
GbyAI
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
TaoSecurity Blog
TaoSecurity Blog
博客园 - 【当耐特】
H
Heimdal Security Blog
腾讯CDC
The Last Watchdog
The Last Watchdog
Security Archives - TechRepublic
Security Archives - TechRepublic
Hacker News: Ask HN
Hacker News: Ask HN
S
Schneier on Security
Microsoft Security Blog
Microsoft Security Blog
WordPress大学
WordPress大学
博客园 - 司徒正美
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
Cybersecurity and Infrastructure Security Agency CISA
S
SegmentFault 最新的问题
大猫的无限游戏
大猫的无限游戏
Application and Cybersecurity Blog
Application and Cybersecurity Blog
F
Full Disclosure
有赞技术团队
有赞技术团队
T
Tailwind CSS Blog
Engineering at Meta
Engineering at Meta
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Threatpost
月光博客
月光博客
A
Arctic Wolf
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
雷峰网
雷峰网
T
Troy Hunt's Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The Cloudflare Blog
D
DataBreaches.Net
O
OpenAI News
L
LINUX DO - 最新话题
宝玉的分享
宝玉的分享
小众软件
小众软件
V
Vulnerabilities – Threatpost
A
About on SuperTechFans
人人都是产品经理
人人都是产品经理
T
The Exploit Database - CXSecurity.com
Martin Fowler
Martin Fowler
美团技术团队
P
Privacy International News Feed

博客园 - shootingstars

硬件相关概念 我的Function C的可变参数 C++概念网摘 Mifare 串行读取协议 韦根协议 学习C的可变参数 关于汇编程序调用各种C函数的例子 如何移植Java的类中的super到C++代码中 编译原理学习 关于标准库中的ptr_fun/binary_function/bind1st/bind2nd 使用python编写每日构建工具 boost::regex学习(5) - shootingstars - 博客园 boost::regex学习(4) - shootingstars - 博客园 boost::regex学习(3) boost::regex学习(2) 《世界大战》《变形金刚》观后感 boost::regex学习(1) boost::algorithm学习
五种迭代器
shootingstars · 2007-06-13 · via 博客园 - shootingstars

1 InputIterator 可以被用来读取容器中的元素但是不保证支持向容器的写入操作
InputIterator 必须提供下列最小支持提供其他支持的iterator 也可被用作InputIterator 只要
它们满足这个最小要求集两个iterator 的相等和不相等测试通过operator ++ 的前置和
后置实例向前递增iterator 指向下一个元素通过解引用操作符operator * 读取一个元素
求在这个层次上提供支持的泛型算法包括find() accumulate()和equal() 任何一个算法如果
要求InputIterator 那么我们也可以向其传递第3 4 5 项列出的iterator 类别中的任一个
即:只要某个类实现上面的操作既可以被认为是InputIterator。
2 OutputIterator 可以被认为是与InputIterator 功能相反的iterator 即它可以被用来向容
器写入元素但是不保证支持读取容器的内容OutputIterator 一般被用作算法的第三个实参
标记出起始写入的位置例如copy()取OutputIterator 作为第三个实参任何一个算法如果
要求OutputIterator 那么我们也可以向其传递第3 4 5 项列出的iterator 类别中的任一个
注意:这个迭代器似乎仅仅实现了赋值操作即可
3 ForwardIterator 可以被用来以某一个遍历方向是的下一个类别支持双向遍历向
容器读或写有些泛型算法至少要求ForwardIterator 包括adjacent_find() swap_range()和
replace() 当然任何要求ForwardIterator 支持的算法都可以向其传递第4 和5 项定义的iterator
类别
注意:这个迭代器既符合InputIterator又符合OutputIterator,同样下面两个也是这样。支持operator++操作
4 BidirectionalIterator 从两个方向读或写一个容器有些泛型算法至少要求
BidirectionalIterator 包括inplace_merge() next_permutation()和reverse()
注意:继承1,2,3的特性,并且支持operator--操作
5 RandomAccessIterator 除了支持BidirectionalIterator 所有的功能之外还提供了在
常数时间内访问容器的任意位置的支持要求RandomAccessIterator 支持的泛型算法包括
binary_search() sort_heap()和nth_element()
注意:继承1,2,3的特性,并且符合随机访问策略,即支持operator[]操作