C++ 命名需求: LegacyContiguousIterator (C++17 起)
來自 cppreference.com
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) |
迭代器庫 | 為迭代器、迭代器特性、介面卡和實用函式提供定義 |