std::ranges::subrange<I,S,K>::next
成员函数 | ||||
(C++20)
|
||||
(C++20)
|
||||
观察器 | ||||
(C++20)
|
||||
(C++20)
|
||||
(C++20)
|
||||
(C++20)
|
||||
迭代器操作 | ||||
(C++20)
|
||||
subrange::next
(C++20)
|
||||
(C++20)
|
||||
推导指引 | ||||
非成员函数 | ||||
(C++20)
|
||||
辅助类型 | ||||
(C++20)
|
||||
(C++20)
|
||||
(C++20)
|
[[nodiscard]]
constexpr
subrange next(std::iter_difference_t<I>
n =
1)
const&
requires std::forward_iterator<I>; |
(1) | (C++20 起) |
[[nodiscard]]
constexpr
subrange next(std::iter_difference_t<I>
n =
1)
&&;
|
(2) | (C++20 起) |
n >= 0
或
n < 0
时迭代器分别相对 *this 的自增
min(n, size())
次或自减 -n
次的 subrange
。等价于 auto tmp = *this; tmp.advance(n);
return tmp; 。n >= 0
或
n < 0
时分别自增
min(n, size())
次或自减 -n
次存储的迭代器,然后从 *this
移动构造结果。等价于 advance(n);
return std::move(*this); 。若
-
I
不实现bidirectional_iterator
且n < 0
,或 - 存储的迭代器在变为不可自减值后被自减,
则行为未定义。
参数
n | - | 迭代器上的最大自增次数 |
返回值
在 n >= 0
或 n < 0
时迭代器分别相对 *this 的迭代器的原值自增
min(n, size())
次或自减 -n
次的 subrange
。
复杂度
通常为在 n >= 0
或 n < 0
时分别为迭代器上的
min(n, size())
次自增或 -n
次自减。
若 I
实现 random_access_iterator
,且 n < 0
或者 std::sized_sentinel_for<S, I> 得到实现则为常数。
注解
调用 (2) 可能将存储的迭代器置于合法但未指定的状态,取决于 I
与
S
的构造函数的行为。
示例
本节未完成 原因:暂无示例 |
参阅
(C++20)
|
以给定距离减少迭代器并返回原 subrange (公开成员函数) |
(C++20)
|
以给定距离前进迭代器 (公开成员函数) |
(C++11)
|
令迭代器自增 (函数模板) |
(C++20)
|
自增迭代器给定的距离或到边界 (niebloid) |