Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::span<T,Extent>::rbegin,std::span<T,Extent>::crbegin

      From cppreference.com
      <cpp‎ |container‎ |span

      [edit template]
       
       
       
       
      constexpr reverse_iterator rbegin()constnoexcept;
      (1)(since C++20)
      constexpr const_reverse_iterator crbegin()constnoexcept;
      (2)(since C++23)

      Returns a reverse iterator to the first element of the reversed*this. It corresponds to the last element of the non-reversed*this.

      If*this is empty, the returned iterator is equal torend().

      range-rbegin-rend.svg

      Contents

      [edit]Return value

      Reverse iterator to the first element.

      [edit]Complexity

      Constant.

      [edit]Notes

      Theunderlying iterator of the returned reverse iterator is theend iterator. Hence the returned iterator is invalidated if and when the end iterator is invalidated.

      [edit]Example

      Run this code
      #include <algorithm>#include <iostream>#include <iterator>#include <span> int main(){constexprstd::span<constchar> code{"@droNE_T0P_w$s@s#_SECRET_a,p^42!"}; auto hack=[](constunsigned O){return O-0141<120;}; std::copy_if(code.rbegin(), code.rend(),std::ostream_iterator<constchar>(std::cout), hack); std::cout<<'\n';}

      Output:

      password

      [edit]See also

      (C++23)
      returns a reverse iterator to the end
      (public member function)[edit]
      returns a reverse iterator to the beginning of a container or array
      (function template)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/container/span/rbegin&oldid=135419"

      [8]ページ先頭

      ©2009-2025 Movatter.jp