C++ 概念: Iterator
来自cppreference.com
|
|
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
Iterator概念描述的类型,可用于识别和遍历容器元素.原文:
The
Iterator concept describes types that can be used to identify and traverse the elements of a container.Iterator是使用迭代器类型:InputIterator,OutputIterator,ForwardIterator,BidirectionalIterator和RandomAccessIterator的基本概念。迭代器可以被看作是一个抽象的指针.原文:
Iterator is the base concept used by other iterator types: InputIterator, OutputIterator, ForwardIterator, BidirectionalIterator, and RandomAccessIterator. Iterators can be thought of as an abstraction of pointers.[编辑] 要求
类型
It是一个Iterator,除其他要求外,下列条件必须得到满足i这种类型的对象原文:
For type
It to be an Iterator, in addition to the other requirements, the following conditions have to be satisfied for an object i of such type:| Expression | Return | Precondition |
|---|---|---|
| *i | reference[1] | i is dereferenceable [2]
|
| ++i | It& |
[编辑] 另请参阅
[编辑] 脚注
- ↑ As defined in iterator_traits中
- ↑ It's a valid iterator pointing to an existing element
原文: