Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::flat_multimap<Key,T,Compare,KeyContainer,MappedContainer>::rbegin,std::flat_multimap<Key,T,Compare,KeyContainer,MappedContainer>::crbegin

      From cppreference.com
      <cpp‎ |container‎ |flat multimap

      [edit template]
       
       
       
      std::flat_multimap
      Member types
      Member functions
      Non-member functions
      Helper classes
      Tags
      Deduction guides
       
      reverse_iterator rbegin()noexcept;
      (1)(since C++23)
      (constexpr since C++26)
      const_reverse_iterator rbegin()constnoexcept;
      (2)(since C++23)
      (constexpr since C++26)
      const_reverse_iterator crbegin()constnoexcept;
      (3)(since C++23)
      (constexpr since C++26)

      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 <string>#include <flat_map> int main(){std::flat_multimap<std::string,int> map{{"█",1},{"▒",5},{"░",3},{"▓",7},{"▓",8},{"░",4},{"▒",6},{"█",2}}; std::cout<<"Print out in reverse order using const reverse iterators:\n";std::for_each(map.crbegin(), map.crend(),[](std::pair<conststd::string,int>const& e){std::cout<<"{\""<< e.first<<"\", "<< e.second<<" };\n";});     map.rbegin()->second=42;// OK, non-const value is modifiable//  map.crbegin()->second = 42; // Error: cannot modify the const value}

      Possible output:

      Print out in reverse order using const reverse iterators:{ "▓", 8 };{ "▓", 7 };{ "▒", 6 };{ "▒", 5 };{ "░", 4 };{ "░", 3 };{ "█", 2 };{ "█", 1 };

      [edit]See also

      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/flat_multimap/rbegin&oldid=168835"

      [8]ページ先頭

      ©2009-2025 Movatter.jp