Iterator library
来自cppreference.com
< cpp
![]() |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
迭代器库提供的迭代器和迭代器的特征,适配器,和实用功能的定义.
Original:
The iterator library provides definitions for five kinds of iterators as well as iterator traits, adapters, and utility functions.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
目录 |
[编辑] 迭代器类
有五种类型的迭代器:
InputIterator
,OutputIterator
,ForwardIterator
,BidirectionalIterator
,和RandomAccessIterator
.Original:
There are five kinds of iterators:
InputIterator
, OutputIterator
, ForwardIterator
, BidirectionalIterator
, and RandomAccessIterator
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
而不是被定义由特定类型的迭代器,每个类别被定义的,可以在其上执行的操作。这个定义是指任何类型支持必要的操作可以被用作一个迭代器 - 例如,一个指针支持所有的操作所需的
RandomAccessIterator
,所以一个指针可以在任何地方使用,预期一个RandomAccessIterator
.Original:
Instead of being defined by specific types, each category of iterator is defined by the operations that can be performed on it. This definition means that any type that supports the necessary operations can be used as an iterator -- for example, a pointer supports all of the operations required by
RandomAccessIterator
, so a pointer can be used anywhere a RandomAccessIterator
is expected.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
五个迭代器类,可以组织成一个层次,更强大的迭代器类别(例如
RandomAccessIterator
)不那么强大的类别(例如InputIterator
):支持的操作Original:
The five iterator categories can be organized into a hierarchy, where more powerful iterator categories (e.g.
RandomAccessIterator
) support the operations of less powerful categories (e.g. InputIterator
):The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Iterator category | Defined operations | |||
---|---|---|---|---|
RandomAccessIterator
|
BidirectionalIterator
|
ForwardIterator
|
InputIterator
|
|
OutputIterator
|
| |||
| ||||
| ||||
|
[编辑] 迭代器原语
提供统一的接口,一个迭代器的属性 Original: provides uniform interface to the properties of an iterator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
空类类型用来表示迭代器类别 Original: empty class types used to indicate iterator categories The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类) | |
基本的迭代器 Original: the basic iterator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
[编辑] 迭代器适配器
反序遍历的迭代器适配器 Original: iterator adaptor for reverse-order traversal The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
(C++11) |
迭代器适配器,它解引用一个右值引用 Original: iterator adaptor which dereferences to an rvalue reference The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
(C++11) |
创建一个std::move_iterator从参数的类型推断 Original: creates a std::move_iterator of type inferred from the argument The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数模板) |
在一个容器的端部,用于插入的迭代器适配器 Original: iterator adaptor for insertion at the end of a container The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
创建一个std::back_insert_iterator从参数的类型推断 Original: creates a std::back_insert_iterator of type inferred from the argument The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数模板) | |
用于插入的容器在前面的迭代器适配器 Original: iterator adaptor for insertion at the front of a container The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
创建一个std::front_insert_iterator从参数的类型推断 Original: creates a std::front_insert_iterator of type inferred from the argument The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数模板) | |
用于插入到一个容器中的迭代器适配器 Original: iterator adaptor for insertion into a container The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
创建一个std::insert_iterator从参数的类型推断 Original: creates a std::insert_iterator of type inferred from the argument The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数模板) |
[编辑] 流迭代器
输入迭代器,读取std::basic_istream Original: input iterator that reads from std::basic_istream The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
输出迭代器,写入std::basic_ostream Original: output iterator that writes to std::basic_ostream The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
输入迭代器,读取std::basic_streambuf Original: input iterator that reads from std::basic_streambuf The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) | |
输出迭代器,写入std::basic_streambuf Original: output iterator that writes to std::basic_streambuf The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (类模板) |
[编辑] 迭代器操作
Defined in header
<iterator> | |
给定距离的迭代器 Original: advances an iterator by given distance The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数) | |
返回两个迭代器之间的距离 Original: returns the distance between two iterators The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数) | |
(C++11) |
增加一个迭代器 Original: increment an iterator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数) |
(C++11) |
减一个迭代器 Original: decrement an iterator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数) |
[编辑] 远程接入
Defined in header
<iterator> | |
(C++11) |
返回一个迭代器的容器或数组的开始 Original: returns an iterator to the beginning of a container or array The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数) |
(C++11) |
返回一个迭代器的容器或数组 Original: returns an iterator to the end of a container or array The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (函数) |