InputIterator
安InputIterator是Iterator它可以从指向元素中读取。InputIteratorS只保证单程算法的有效性:一旦InputIteratori已递增,其以前值的所有副本都可能无效。
所需
类型It满足InputIterator如果。
- 类型
It满足Iterator
- 类型
It满足EqualityComparable
还有,给予。
i和j,类型值It或const It
reference,所表示的类型std::iterator_traits<It>::reference
value_type,所表示的类型std::iterator_traits<It>::value_type
下列表达式必须有效并具有指定的效果。
Expression | Return | Equivalent expression | Notes |
|---|---|---|---|
i != j | contextually convertible to bool | !(i == j) | Precondition: (i, j) is in the domain of ==. |
*i | reference, convertible to value_type | If i == j and (i, j) is in the domain of == then this is equivalent to *j. | Precondition: i is dereferenceable. The expression (void)*i, *i is equivalent to *i. |
i->m | | (*i).m | Precondition: i is dereferenceable. |
++i | It& | | Precondition: i is dereferenceable. Postcondition: i is dereferenceable or i is past-the-end. Postcondition: Any copies of the previous value of i are no longer required to be either dereferenceable or to be in the domain of ==. |
(void)i++ | | (void)++i | |
*i++ | convertible to value_type | value_type x = *i; ++i; return x; | |
注记
“在...领域==“意味着在两个迭代器值之间定义相等比较。对于输入迭代器,不需要为所有值以及==可能会随着时间的推移而改变。
大reference输入迭代器的类型,而输入迭代器也不是ForwardIterator不一定是引用类型:取消引用输入迭代器可能返回代理对象或value_type的值为%28 As。std::istreambuf_iterator29%。
另见
- Iterator库
© cppreference.com在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com

