Team LiB
Previous Section Next Section

Defined Terms

术语

back_inserter

Iterator adaptor that takes a reference to a container and generates an insert iterator that uses push_back to add elements to the specified container.

形参为指向容器的引用的迭代器适配器,生成使用 push_back 为指定容器添加元素的插入迭代器。

bidirectional iterator(双向迭代器)

Same operations as forward iterators plus the ability to use to move backward through the sequence.

除了提供前向迭代器相同的操作之外,还支持使用——操作符向后遍历序列。

forward iterator(前向迭代器)

Iterator that can read and write elements, but does not support --.

可读写元素的迭代器,但不支持——操作符。

front_inserter

Iterator adaptor that given a container, generates an insert iterator that uses push_front to add elements to the beginning of that container.

一种迭代器适配器,生成使用 push_front 在指定容器的开始位置添加新元素的插入迭代器。

generic algorithms(泛型算法)

Type-independent algorithms.

与类型无关的算法。

input iterator(输入迭代器)

Iterator that can read but not write elements.

只能读不能写元素的迭代器。

insert iterator(插入迭代器)

Iterator that uses a container operation to insert elements rather than overwrite them. When a value is assigned to an insert iterator, the effect is to insert the element with that value into the sequence.

使用容器操作插入元素而不是覆写元素的迭代器。给插入迭代器赋值,等效于将具有所赋值的新元素插入到序列中。

inserter(插入器)

Iterator adaptor that takes an iterator and a reference to a container and generates an insert iterator that uses insert to add elements just ahead of the element referred to by the given iterator.

一种迭代器适配器,形参为一个迭代器和一个指向容器的引用,生成使用 insert 为容器添加元素的插入迭代器,新元素插入在该适配器的迭代器形参所指向的元素前面。

istream_iterator

Stream iterator that reads an input stream.

读输入流的流迭代器。

iterator categories(迭代器种类)

Conceptual organization of iterators based on the operations that an iterator supports. Iterator categories form a hierarchy, in which the more powerful categories offer the same operations as the lesser categories. The algorithms use iterator categories to specify what operations the iterator arguments must support. As long as the iterator provides at least that level of operation, it can be used. For Example, some algorithms require only input iterators. Such algorithms can be called on any iterator other than one that meets only the output iterator requirements. Algorithms that require random-access iterators can be used only on iterators that support random-access operations.

基于迭代器所支持的操作,在概念上对迭代器进行分类。迭代器种类形成了一个层次结构,功能较强的迭代器种类提供比它弱的迭代器的所有操作。算法使用迭代器种类来指定它的迭代器实参必须支持什么操作。只要迭代器至少提供这个层次的操作,就可以用于该算法。例如,一些算法只要求输入迭代器,则可以使用除了输出迭代器之外的任意迭代器调用这样的算法。而要求使用随机访问迭代器的算法只能用在支持随机访问运算的迭代器上。

off-the-end iterator(超出末端迭代器)

An iterator that marks the end of a range of elements in a sequence. The off-the-end iterator is used as a sentinel and refers to an element one past the last element in the range. The off-the-end iterator may refer to a nonexistent element, so it must never be dereferenced.

一种迭代器,用于标记序列中一个元素范围的结束位置。超出末端迭代器用作结束遍历的“哨兵”,指向范围内最后一个元素的下一位置。超出末端迭代器可能指向不存在的元素,因此永远不能做解引用运算。

ostream_iterator

Iterator that writes to an output stream.

写输出流的迭代器。

output iterator(输出迭代器)

Iterator that can write but not read elements.

只能写不能读元素的迭代器。

predicate(谓词)

Function that returns a type that can be converted to bool. Often used by the generic algorithms to test elements. Predicates used by the library are either unary (taking one argument) or binary (taking two).

其返回类型可转换为 bool 值的函数。通常被泛型算法用于检查元素。标准库所使用的谓词函数不是一元(需要一个实参)的就是二元的(需要两个实参)。

random-access iterator(随机访问迭代器)

Same operations as bidirectional iterators plus the ability to use the relational operators to compare iterator values and the ability to do arithmetic on iterators, thus supporting random access to elements.

除了支持双向迭代器相同的操作之外,还提供了使用关系运算比较迭代器值的能力,以及在迭代器上做算术运算的能力。因此,这类迭代器支持随机访问元素。

reverse iterator(反向迭代器)

Iterator that moves backward through a sequence. These iterators invert the meaning of ++ and --.

向后遍历序列的迭代器。这些迭代器颠倒了 ++-- 的含义。

stream iterator(流迭代器)

Iterator that can be bound to a stream.

可与流绑定在一起的迭代器。

Team LiB
Previous Section Next Section