C++ 命名需求: LegacyContiguousIterator (C++17 起)
来自 cppreference.cn
LegacyContiguousIterator 是一个 LegacyIterator,其逻辑相邻元素在内存中也是物理相邻的。
指向数组元素的指针满足 LegacyContiguousIterator 的所有要求。
目录 |
[编辑] 要求
若类型 It 满足 LegacyContiguousIterator,则
- 类型 It 满足 LegacyIterator
并且,对于每个
- a,一个可解引用的 It 类型迭代器
- n,一个整型值
使得
- a + n 是一个有效且可解引用的迭代器值
则
- *(a + n) 等价于 *(std::addressof(*a) + n)。
[编辑] 标准库
以下标准库类型是 LegacyContiguousIterator。
- array::iterator.
- basic_string_view::iterator.
- basic_string::iterator.
- vector::iterator 对于非 bool 的
value_type
。 - begin(valarray) 和 end(valarray) 的返回类型。
[编辑] 注意
花式指针 到对象类型也要求满足 LegacyContiguousIterator。
LegacyContiguousIterator 被 |
(C++20 起) |
[编辑] 另请参阅
(C++20) |
指定random_access_iterator 是连续迭代器,引用内存中连续的元素(concept) |
迭代器库 | 为迭代器、迭代器特性、适配器和实用函数提供定义 |