Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::ranges::concat_view<Views...>::iterator

      From cppreference.com
      <cpp‎ |ranges‎ |concat view
       
       
      Ranges library
      Range adaptors
       
      std::ranges::concat_view
      Member functions
      Deduction guides
      Iterator
      Member functions
      Non-member functions
       
      template<bool Const>
      class/*iterator*/
      (1)(exposition only*)
      Helper concepts
      template<bool Const,class...Rs>
      concept/*concat-is-random-access*/=/* see description */;
      (2)(exposition only*)
      template<bool Const,class...Rs>
      concept/*concat-is-bidirectional*/=/* see description */;
      (3)(exposition only*)
      1)ranges::concat_view<Views...>::iterator is the type of the iterators returned bybegin() andend() ofranges::concat_view<Views...>.
      2) LetFs be the pack that consists of all elements ofRs except the last element. Equivalent to

      template<bool Const,class...Rs>
      concept concat-is-random-access =// exposition only
          all-random-access <Const, Rs...>&&
          (ranges::common_range<maybe-const <Const, Fs>>&& ...);

      .
      3) LetFs be the pack that consists of all elements ofRs except the last element. Equivalent to

      template<bool Const,class...Rs>
      concept concat-is-bidirectional =// exposition only
          all-bidirectional <Const, Rs...>&&
          (ranges::common_range<maybe-const <Const, Fs>>&& ...);

      .

      Contents

      [edit]Template parameters

      Const - whether the iterator is a constant iterator

      [edit]Nested types

      Exposition-only types
      Type Definition
      base-iterstd::variant<ranges::iterator_t<maybe-const <Const, Views>>...>
      (exposition-only member type*)
      Iterator property types
      Type Definition
      iterator_concept aniterator tag,see below
      iterator_category
      (conditionally present)
      an iterator tag,see below
      value_typeconcat-value-t <maybe-const <Const, Views>...>
      difference_type

      std::common_type_t<ranges::range_difference_t<maybe-const <Const, Views>>...>

      [edit]Determining the iterator concept

      iterator_concept is defined as follows:

      [edit]Determining the iterator category

      iterator_category is defined if and only ifall-forward <Const, Views...> is modeled. In this case, it is defined as follows:

      [edit]Data members

      Member Definition
      maybe-const <Const,ranges::concat_view>*parent_ a pointer to the parentconcat_view
      (exposition-only member object*)
      base-iterit_ an iterator into the current view
      (exposition-only member object*)

      [edit]Member functions

      constructs an iterator
      (public member function)
      accesses the element
      (public member function)
      accesses an element by index
      (public member function)
      advances or decrements the underlying iterator
      (public member function)[edit]
      Exposition-only function templates
      replacesit_ with the beginning of the next view, ifit_ is the end of current view
      (exposition-only member function*)
      decrementsit_ such that it points to the previous position
      (exposition-only member function*)
      advances the current position on given offset
      (exposition-only member function*)
      decrements the current position on given value
      (exposition-only member function*)

      [edit]Non-member functions

      compares the underlying iterators
      (function)
      performs iterator arithmetic
      (function)
      (C++26)
      casts the result of dereferencing the underlying iterator to its associated rvalue reference type
      (function)
      (C++26)
      swaps the objects pointed to by two underlying iterators
      (function)

      [edit]Example

      The preliminary version can be checked out onCompiler Explorer.

      Run this code
      #include <iostream>#include <iterator>#include <ranges> int main(){namespace views= std::views;staticconstexprint p[]{1,2,3};staticconstexprauto e={4,5};auto t=views::iota(6,9);auto cat=views::concat(p, e, t);auto dog=views::concat(cat, cat);for(auto i{dog.begin()}; i!=std::default_sentinel;++i)std::cout<<*i<<' ';std::cout<<'\n';}

      Output:

      1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8

      [edit]References

      • C++26 standard (ISO/IEC 14882:2026):
      • 26.7.18.3 Class templateconcat_view::iterator [range.concat.iterator]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/ranges/concat_view/iterator&oldid=176905"

      [8]ページ先頭

      ©2009-2025 Movatter.jp