Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::ranges::stride_view<V>::begin

      From cppreference.com
      <cpp‎ |ranges‎ |stride view
       
       
      Ranges library
      Range adaptors
       
      std::ranges::stride_view
      Member functions
      stride_view::begin
      Deduction guides
      Iterator
      Member functions
      Non-member functions
       
      constexprauto begin() requires(!__simple_view<V>);
      (1)(since C++23)
      constexprauto begin()const requiresranges::range<const V>;
      (2)(since C++23)

      Returns aniterator to the first element of thestride_view.

      1) Equivalent toreturn iterator<false>(this,ranges::begin(base_));.
      2) Equivalent toreturn iterator<true>(this,ranges::begin(base_));.

      Overload(1) does not participate in overload resolution ifV is asimple view (that is, ifV andconst V are views with the same iterator and sentinel types).

      Contents

      [edit]Parameters

      (none)

      [edit]Return value

      Iterator to the first element of the view.

      [edit]Example

      A link to test:Compiler Explorer.

      Run this code
      #include <print>#include <ranges> int main(){constexprauto v={'A','B','C'};constauto x= v| std::views::stride(2);constauto y= v| std::views::reverse| std::views::stride(2);constauto z= v| std::views::stride(2)| std::views::reverse;std::println("{} {} {}",*x.begin(),*y.begin(),*z.begin());}

      Output:

      A C C

      [edit]See also

      returns an iterator or a sentinel to the end
      (public member function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/ranges/stride_view/begin&oldid=144968"

      [8]ページ先頭

      ©2009-2025 Movatter.jp