std::experimental::ranges:: ForwardIterator
| Technical Specification | ||||
| Filesystem library (filesystem TS) | ||||
| Library fundamentals (library fundamentals TS) | ||||
| Library fundamentals 2 (library fundamentals TS v2) | ||||
| Library fundamentals 3 (library fundamentals TS v3) | ||||
| Extensions for parallelism (parallelism TS) | ||||
| Extensions for parallelism 2 (parallelism TS v2) | ||||
| Extensions for concurrency (concurrency TS) | ||||
| Extensions for concurrency 2 (concurrency TS v2) | ||||
| Concepts (concepts TS) | ||||
| Ranges (ranges TS) | ||||
| Reflection (reflection TS) | ||||
| Mathematical special functions (special functions TR) | ||||
| Experimental Non-TS | ||||
| Pattern Matching | ||||
| Linear Algebra | ||||
| std::execution | ||||
| Contracts | ||||
| 2D Graphics |
| Iterator concepts | |||||||||||||||||||||||
|
|||||||||||||||||||||||
| Indirect callable concepts | |||||||||||||||||||||||
| Common algorithm requirements | |||||||||||||||||||||||
| Concept utilities | |||||||||||||||||||||||
| Iterator utilities and operations | |||||||||||||||||||||||
| Iterator traits | |||||||||||||||||||||||
| Iterator adaptors | |||||||||||||||||||||||
| Stream iterators | |||||||||||||||||||||||
|
template
<
class
I
>
concept
bool
ForwardIterator
=
|
(ranges TS) | |
概念
ForwardIterator<I>
通过增加相等性比较和多趟遍历保证来细化
InputIterator
。
对于前向迭代器而言,
==
的定义域是同一底层序列上的迭代器,但相同类型的值初始化迭代器可以相互比较且应判定为相等。
从指向范围
[
i
,
s
)
的前向迭代器获取的指针和引用,在
[
i
,
s
)
持续表示有效范围期间必须保持有效。
设
a
和
b
为类型
I
的两个可解引用迭代器。仅当满足以下条件时,
ForwardIterator<I>
才成立:
- a == b 意味着 ++ a == ++ b ;且
-
表达式
(
[
]
(
X x
)
{
++
x
;
}
(
a
)
,
*
a
)
等价于
*
a
,即递增
a的副本对解引用a的结果没有影响。
这被称为 多遍保证 。
注释
前向迭代器不能是“隐匿式”的:它不能返回对自身内部对象的引用,因为这类引用会因前向迭代器的销毁而失效。