名前空間
変種
操作

std::ranges::chunk_view<V>::inner-iterator

From cppreference.com
< cpp‎ | ranges‎ | chunk view
 
 
Rangesライブラリ
Rangeアダプタ
 
std::ranges::chunk_view
メンバ関数
input_range のクラス
推論補助
outer-iterator
outer-iterator::value_type
inner-iterator
 
class /*inner-iterator*/
(C++23から)
(説明用*)

Vinput_range をモデルとする場合、chunk_view::outer-iterator::value_type::begin の戻り値の型。

目次

[edit] メンバ型

メンバ型 定義
iterator_concept std::input_iterator_tag
difference_type ranges::range_difference_t<V>
value_type ranges::range_value_t<V>

[edit] データメンバ

メンバオブジェクト 定義
parent_ (private) ranges::chunk_view* の「親オブジェクト」へのポインタ。
(説明用のメンバオブジェクト*)

[edit] メンバ関数

イテレータを構築する
(public member function)
(C++23)
別のイテレータをムーブ代入する
(public member function)
(C++23)
現在の要素へのイテレータを返す
(public member function)
(C++23)
要素にアクセスします
(public member function)
イテレータを進める
(public member function)

[edit] 非メンバ関数

イテレータと default sentinel を比較する
(関数)
(C++23)
残りの要素数を計算する
(関数)
(C++23)
基底イテレータの間接参照の結果を関連する右辺値参照型にキャストする
(関数)
(C++23)
2つの基底イテレータが指すオブジェクトをスワップする
(関数)

[edit]

#include <iostream>
#include <iterator>
#include <ranges>
#include <sstream>
 
int main()
{
    auto letters = std::istringstream{"ABCDEFGHIJK"};
 
    auto chunks = std::ranges::istream_view<char>(letters)
                | std::views::chunk(4);
 
    for (auto chunk : chunks)
    {
        // chunk is an object of type chunk_view::outer_iterator::value_type
        std::cout << '[';
        for (auto inner_iter = chunk.begin(); inner_iter != std::default_sentinel;
             ++inner_iter)
            std::cout << *inner_iter;
        std::cout << "] ";
    }
    std::cout << '\n';
}

出力

[ABCD] [EFGH] [IJK]

[edit] 参考文献

  • C++23標準 (ISO/IEC 14882:2024)
  • 26.7.28.5 Class chunk_view::inner-iterator [range.chunk.inner.iter]

[edit] 関連項目

English 日本語 中文(简体) 中文(繁體)