Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::ranges::slide_view<V>::end

      From cppreference.com
      <cpp‎ |ranges‎ |slide view
       
       
      Ranges library
      Range adaptors
       
      std::ranges::slide_view
      Member functions
      slide_view::end
      Deduction guides
      Iterator
      Member functions
      Non-member functions
      Sentinel
      Member functions
      Non-member functions
       
      constexprauto end()
          requires(!(/*simple-view*/<V>&&/*slide-caches-nothing*/<const V>));
      (1)(since C++23)
      constexprauto end()const
          requires/*slide-caches-nothing*/<const V>;
      (2)(since C++23)

      Returns asentinel or aniterator representing the end of theslide_view.

      1) Letbase_ andn_ be the underlying data members. Equivalent to:
      IfV modelsslide-caches-last, this function caches the result within thecached_end_ for use on subsequent calls. This is necessary to provide the amortized constant-time complexity required by therange.
      2) Equivalent tobegin()+ranges::range_difference_t<const V>(size()).

      Contents

      [edit]Parameters

      (none)

      [edit]Return value

      Asentinel or aniterator representing the end of theslide_view.

      [edit]Example

      Run this code
      #include <iostream>#include <ranges> int main(){staticconstexprauto source={'A','B','C','D'}; for(constauto subrange: source| std::views::slide(3)){std::cout<<"[ ";for(auto it= subrange.begin(); it!= subrange.end();++it)std::cout<<*it<<' ';std::cout<<"]\n";}}

      Output:

      [ A B C ][ B C D ]

      [edit]See also

      returns an iterator to the beginning
      (public member function)[edit]
      returns an iterator to the beginning of a range
      (customization point object)[edit]
      returns a sentinel indicating the end of a range
      (customization point object)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/ranges/slide_view/end&oldid=181262"

      [8]ページ先頭

      ©2009-2025 Movatter.jp