首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

InputIterator

InputIteratorIterator它可以从指向元素中读取。InputIteratorS只保证单程算法的有效性:一旦InputIteratori已递增,其以前值的所有副本都可能无效。

所需

类型It满足InputIterator如果。

  • 类型It满足Iterator
  • 类型It满足EqualityComparable

还有,给予。

  • ij,类型值Itconst 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库
代码语言:txt
复制
 ? cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com