![]() |
Home | Libraries | People | FAQ | More |
InputIterator 輸入迭代器
An input iterator is an iterator that can read through a
sequence of values. It is single-pass (old values of the iterator
cannot be re-used), and read-only.
輸入迭代器是一種可以讀入一組值的序列的迭代器。它是單遍的(迭代器的舊值不可重用)和只讀的。
An input iterator represents a position in a sequence.
Therefore, the iterator can point into the sequence (returning a value
when dereferenced and being incrementable), or be off-the-end (and not
dereferenceable or incrementable).
輸入迭代器表示了在一個序列中的某個位置。因此,迭代器可以指向序列內部(在提領時返回一個值且可以遞增),或者指向序列末端之後(不可提領且不可遞
增)。
value_type
std::iterator_traits<Iter>::value_type
The value type of the iterator (not necessarily what *i returns)
迭代器的值類型(不一定是 *i 所返回的)
difference_type
std::iterator_traits<Iter>::difference_type
The difference type of the iterator
迭代器的距離類型
category
std::iterator_traits<Iter>::iterator_category
The category of the iterator
迭代器的類別
i,
j
xcategory must be derived from std::input_iterator_tag, a model of DefaultConstructible, and a model of CopyConstructible.
value_type must be a model of CopyConstructible.
value_type 必須為 可複製構造。
difference_type must be a model of SignedInteger.
difference_type 必須為 有符號整數。
| Name 名字 | Expression 表達式 | Type 類型 | Precondition 前置條件 | Semantics 語義 | Postcondition 後置條件 |
|---|---|---|---|---|---|
|
Dereference 提領 |
*i |
Convertible to value_type 可轉換為 value_type |
|
||
|
Preincrement 前綴遞增 |
++i |
Iter & |
|
||
|
Postincrement 後綴遞增 |
i++ |
|
Equivalent to
|
|
|
|
Postincrement and dereference 後綴遞增並提領 |
*i++ |
Convertible to value_type |
|
Equivalent to
|
|