operator+,-(ranges::chunk_view::iterator)
來自 cppreference.com
< cpp | ranges | chunk view | iterator
friend constexpr /*iterator*/ operator+( const /*iterator*/& i, difference_type pos ) |
(1) | (C++23 起) |
friend constexpr /*iterator*/ operator+( difference_type pos, const /*iterator*/& i ) |
(2) | (C++23 起) |
friend constexpr /*iterator*/ operator-( const /*iterator*/& i, difference_type pos ) |
(3) | (C++23 起) |
friend constexpr difference_type operator-( const /*iterator*/& i, const /*iterator*/& j ) |
(4) | (C++23 起) |
friend constexpr difference_type operator-( std::default_sentinel_t, const /*iterator*/& i ) |
(5) | (C++23 起) |
friend constexpr difference_type operator-( const /*iterator*/& i, std::default_sentinel_t ) |
(6) | (C++23 起) |
執行 迭代器 算術或計算距離。
令 current_
、end_
、n_
和 missing_
為底層資料成員。
等價於
1,2) auto r = i; r += pos; return r;。
3) auto r = i; r -= pos; return r;。
4) return (i.current_ - j.current_ + i.missing_ - j.missing_) / i.n_;。
5) return /*div-ceil*/(i.end_ - i.current_, i.n_);。
6) return -(y - x);。
這些函式對普通的非限定查詢或限定查詢不可見,只能透過實參依賴查詢在 chunk_view::iterator<Const>
是實參的關聯類時才能找到。
目錄 |
[編輯] 引數
i, j | - | 迭代器 |
pos | - | 相對於當前位置的偏移量 |
[編輯] 返回值
1,2) 一個自增後的迭代器。
3) 一個自減後的迭代器。
4) 給定迭代器之間的距離(以元素,即塊的數量計)。
5,6) 給定迭代器與哨兵之間的距離(以元素數量計)。
[編輯] 示例
本節不完整 原因:無示例 |
[編輯] 參閱
前進或後退底層迭代器 (public member function) |