Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

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

      From cppreference.com
      <cpp‎ |ranges‎ |chunk view
       
       
      Ranges library
      Range adaptors
       
      std::ranges::chunk_view
      Member functions
      Classes forinput_ranges
      Deduction guides
      outer-iterator
      outer-iterator::value_type
      inner-iterator
       
      class/*inner-iterator*/
      (since C++23)
      (exposition only*)

      The return type ofchunk_view::outer-iterator::value_type::begin ifV modelsinput_range.

      Contents

      [edit]Member types

      Member type Definition
      iterator_conceptstd::input_iterator_tag
      difference_typeranges::range_difference_t<V>
      value_typeranges::range_value_t<V>

      [edit]Data members

      Member object Definition
      parent_(private) A pointer to the "parent object" of typeranges::chunk_view*.
      (exposition-only member object*)

      [edit]Member functions

      constructs an iterator
      (public member function)
      (C++23)
      move assigns another iterator
      (public member function)
      (C++23)
      returns an iterator to the current element
      (public member function)
      (C++23)
      accesses the element
      (public member function)
      (C++23)
      increments the iterator
      (public member function)

      [edit]Non-member functions

      (C++23)
      compares the iterator withdefault sentinel
      (function)
      (C++23)
      calculates the remained number of elements
      (function)
      (C++23)
      casts the result of dereferencing the underlying iterator to its associated rvalue reference type
      (function)
      (C++23)
      swaps the objects pointed to by two underlying iterators
      (function)

      [edit]Example

      Run this code
      #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_typestd::cout<<'[';for(auto inner_iter= chunk.begin(); inner_iter!=std::default_sentinel;++inner_iter)std::cout<<*inner_iter;std::cout<<"] ";}std::cout<<'\n';}

      Output:

      [ABCD] [EFGH] [IJK]

      [edit]References

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

      [edit]See also

      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/ranges/chunk_view/inner_iterator&oldid=160869"

      [8]ページ先頭

      ©2009-2026 Movatter.jp