名稱空間
變體
操作

operator+,-(ranges::concat_view::iterator)

來自 cppreference.com
< cpp‎ | ranges‎ | concat view‎ | iterator
 
 
範圍庫 (Ranges library)
範圍介面卡 (Range adaptors)
 
 
friend constexpr /*iterator*/

    operator+( const /*iterator*/& it, difference_type n )

        requires /*concat-is-random-access*/<Const, Views...>;
(1) (C++26 起)
friend constexpr /*iterator*/

    operator+( difference_type n, const /*iterator*/& it )

        requires /*concat-is-random-access*/<Const, Views...>;
(2) (C++26 起)
friend constexpr /*iterator*/

    operator-( const /*iterator*/& it, difference_type n )

        requires /*concat-is-random-access*/<Const, Views...>;
(3) (C++26 起)
friend constexpr difference_type

    operator-( const /*iterator*/& x, const /*iterator*/& y )

        requires /*concat-is-random-access*/<Const, Views...>;
(4) (C++26 起)
friend constexpr difference_type

    operator-( const /*iterator*/& x, std::default_sentinel_t )

        requires /* see description */;
(5) (C++26 起)
friend constexpr difference_type

    operator-( std::default_sentinel_t, const /*iterator*/& x )

        requires /* see description */;
(6) (C++26 起)

遞增或遞減迭代器

1) 等價於 auto t = it; t += n; return t;
2) 等價於 return it + n;
3) 等價於 auto t = it; t -= n; return t;
4)Ixx.it_ .index()Iyy.it_ .index()
x.it_ .valueless_by_exception() || y.it_ .valueless_by_exception()true,則行為未定義。
5)Ixx.it_ .index(),等價於 difference_type result = ranges::distance(x.get-iter <Ix>(), x.get-end <Ix>());
for (std::size_t I = Ix + 1, count = sizeof...(Views); I < count; I++)
    result += ranges::distance(x.get-view <I>());
return -result;
Fs 為除第一個元素外 Views 的所有元素組成的包,則 requires 子句中的表示式等價於

(std::sized_sentinel_for<ranges::sentinel_t<maybe-const <Const, Views>>,
                         ranges::iterator_t<maybe-const <Const, Views>>> && ...) &&
    (ranges::sized_range<maybe-const <Const, Fs>> && ...)

x.it_ .valueless_by_exception()true,則行為未定義。
6) 等價於 return -(x - std::default_sentinel);
Fs 為除第一個元素外 Views 的所有元素組成的包,則 requires 子句中的表示式等價於

(std::sized_sentinel_for<ranges::sentinel_t<maybe-const <Const, Views>>,
                         ranges::iterator_t<maybe-const <Const, Views>>> && ...) &&
    (ranges::sized_range<maybe-const <Const, Fs>> && ...)

x.it_ .valueless_by_exception()true,則行為未定義。

這些函式對於普通的非限定限定查詢不可見,並且只有在 concat_view::iterator <Const> 是引數的關聯類時,才能透過實參依賴查詢找到。

目錄

[編輯] 引數

it, x, y - 迭代器
n - 一個相對於當前位置的位置

[編輯] 返回值

如上所述。

[編輯] 示例

[編輯] 參閱

前進或後退底層迭代器
(public member function) [編輯]