no-throw-input-iterator, no-throw-forward-iterator, no-throw-sentinel-for, no-throw-input-range, no-throw-forward-range
来自 cppreference.cn
template< class I > concept no-throw-input-iterator = |
(1) | (仅作说明*) |
template< class I > concept no-throw-forward-iterator = |
(2) | (仅作说明*) |
template< class S, class I > concept no-throw-sentinel-for = std::sentinel_for<S, I>; |
(3) | (仅作说明*) |
template< class R > concept no-throw-input-range = |
(4) | (仅作说明*) |
template< class R > concept no-throw-forward-range = |
(5) | (仅作说明*) |
这些仅用于解释的概念指定了迭代器、哨兵和范围上的算法所需的操作不会抛出异常。
[编辑] 语义要求
与所有标准概念一样,此处列出的每个概念仅在其所有子概念都被建模时才被建模。
1) 类型
I
仅当通过有效迭代器进行递增、复制构造、移动构造、复制赋值、移动赋值或解引用操作不抛出异常时,才建模 no-throw-input-iterator
。3) 类型
S
和 I
仅当通过类型 I
和 S
的有效值之间的复制构造、移动构造、复制赋值、移动赋值或比较不抛出异常时,才建模 no-throw-sentinel-for
。[编辑] 注意
这些概念允许对迭代器和哨兵进行某些操作抛出异常,例如对无效值的操作。
[编辑] 参阅
(C++20) |
指定类型是一个输入迭代器,即其引用的值可读,并且可以进行前置和后置增量 (概念) |
(C++20) |
指定input_iterator 是前向迭代器,支持相等比较和多趟遍历(概念) |
(C++20) |
指定类型是input_or_output_iterator 类型的哨兵(概念) |
(C++20) |
指定其迭代器类型满足 input_iterator 的范围(概念) |
(C++20) |
指定其迭代器类型满足 forward_iterator 的范围(概念) |