Namespaces
Variants

std::ranges::stride_view<V>:: iterator <Const>:: operator++,--,+=,-=

From cppreference.net
Ranges library
Range adaptors
constexpr /*iterator*/ & operator ++ ( ) ;
(1) (自 C++23 起)
constexpr void operator ++ ( int ) ;
(2) (自 C++23 起)
constexpr /*iterator*/ operator ++ ( int )
requires ranges:: forward_range < Base > ;
(3) (自 C++23 起)
constexpr /*iterator*/ & operator -- ( )
requires ranges:: bidirectional_range < Base > ;
(4) (自 C++23 起)
constexpr /*iterator*/ operator -- ( int )
requires ranges:: bidirectional_range < Base > ;
(5) (自 C++23 起)
constexpr /*iterator*/ & operator + = ( difference_type n )
requires ranges:: random_access_range < Base > ;
(6) (自 C++23 起)
constexpr /*iterator*/ & operator - = ( difference_type n )
requires ranges:: random_access_range < Base > ;
(7) (自 C++23 起)

递增或递减 迭代器

current_ end_ stride_ missing_ 作为 迭代器 的数据成员。

1) 等价于
missing_ = ranges::advance(current_, stride_, end_);
return *this
在调用前 current_ 不应等于 end_
2) 等价于 ++* this ;
3) 等价于 auto tmp = * this ; ++* this ; return tmp ;
4) 等价于
ranges::advance(current_, missing_ - stride_);
missing_ = 0;
return *this;
5) 等价于 auto tmp = * this ; --* this ; return tmp ;
6) 等价于
if (n > 0)
{
    ranges::advance(current_, stride_ * (n - 1));
    missing_ = ranges::advance(current_, stride_, end_);
}
else if (n < 0)
{
    ranges::advance(current_, stride_ * n + missing_);
    missing_ = 0;
}
return *this;

n > 0 ,则在此函数调用前, ranges:: distance ( current_, end_ ) 必须大于 stride_ * ( n - 1 )

注意若 n < 0 ,则 ranges:: distance ( current_, end_ ) 始终大于(非正数) stride_ * ( n - 1 )
7) 等价于 return * this + = - n ;

目录

参数

n - 相对于当前位置的偏移量

返回值

1,4,6,7) * this
2) (无)
3,5) 在更改前创建的 * this 副本

示例

参见

执行迭代器算术运算
(函数)