跳到主要内容

C++ 命名要求: LegacyContiguousIterator (自 C++17 起)

一个 LegacyContiguousIterator 是一个 LegacyIterator,其逻辑上相邻的元素在内存中也是物理上相邻的。

指向数组元素的指针满足 LegacyContiguousIterator 的所有要求。

要求

如果类型 It 满足 LegacyContiguousIterator,则:

类型 It 满足 LegacyIterator 并且,对于每个

  • a,类型 It 的一个可解引用迭代器
  • n,一个整数值

使得

  • a + n 是一个有效且可解引用的迭代器值

那么

  • *(a + n) 等价于 *(std::addressof(*a) + n)

标准库

以下标准库类型是 LegacyContiguousIterator

备注

花式指针到对象类型也需要满足 LegacyContiguousIterator

LegacyContiguousIteratorcontiguous_iterator 概念取代:在 C++17 中要求满足 LegacyContiguousIterator 的标准库迭代器类型,在 C++20 中要求满足 contiguous_iterator 概念。 (自 C++20 起)

C++ 命名要求: LegacyContiguousIterator (自 C++17 起)

一个 LegacyContiguousIterator 是一个 LegacyIterator,其逻辑上相邻的元素在内存中也是物理上相邻的。

指向数组元素的指针满足 LegacyContiguousIterator 的所有要求。

要求

如果类型 It 满足 LegacyContiguousIterator,则:

类型 It 满足 LegacyIterator 并且,对于每个

  • a,类型 It 的一个可解引用迭代器
  • n,一个整数值

使得

  • a + n 是一个有效且可解引用的迭代器值

那么

  • *(a + n) 等价于 *(std::addressof(*a) + n)

标准库

以下标准库类型是 LegacyContiguousIterator

备注

花式指针到对象类型也需要满足 LegacyContiguousIterator

LegacyContiguousIteratorcontiguous_iterator 概念取代:在 C++17 中要求满足 LegacyContiguousIterator 的标准库迭代器类型,在 C++20 中要求满足 contiguous_iterator 概念。 (自 C++20 起)