InputIterator
输入迭代器(Input iterator)是一个可以遍历一系列值的迭代器。它只能单次通过(不能重复使用迭代器的旧值),并且是只读的。
输入迭代器代表序列中的一个位置。因此,迭代器可以指向序列中的某个元素(在解引用时返回值,并且是可递增的),或者指向序列末尾(不可解引用或递增)。
value_type
std::iterator_traits<Iter>::value_type
迭代器的值类型(不一定是 *i
返回的值)
difference_type
std::iterator_traits<Iter>::difference_type
迭代器的差值类型
category
std::iterator_traits<Iter>::iterator_category
迭代器的类别
category 必须派生自 std::input_iterator_tag,是 DefaultConstructible 的一个模型,并且是 CopyConstructible 的一个模型。
value_type 必须是 CopyConstructible 的一个模型。
difference_type 必须是 SignedInteger 的一个模型。