std::multimap<Key,T,Compare,Allocator>:: rbegin, std::multimap<Key,T,Compare,Allocator>:: crbegin
|
(C++17)
|
||||
| Sequence | ||||
|
(C++11)
|
||||
|
(C++26)
|
||||
|
(C++26)
|
||||
|
(C++11)
|
||||
| Associative | ||||
| Unordered associative | ||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
| Adaptors | ||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
| Views | ||||
|
(C++20)
|
||||
|
(C++23)
|
||||
| Tables | ||||
| Iterator invalidation | ||||
| Member function table | ||||
| Non-member function table |
| Member functions | |||||||||||||||||||||||||||
| Non-member functions | |||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||
| Deduction guides (C++17) | |||||||||||||||||||||||||||
|
reverse_iterator rbegin
(
)
;
|
(1) |
(C++11부터 noexcept)
(C++26부터 constexpr) |
|
const_reverse_iterator rbegin
(
)
const
;
|
(2) |
(C++11부터 noexcept)
(C++26부터 constexpr) |
|
const_reverse_iterator crbegin
(
)
const
noexcept
;
|
(3) |
(C++11부터)
(C++26부터 constexpr) |
역순으로 바뀐 * this 의 첫 번째 요소를 가리키는 역방향 반복자를 반환합니다. 이는 역순으로 바뀌지 않은 * this 의 마지막 요소에 해당합니다.
만약 * this 가 비어 있으면, 반환된 반복자는 rend() 와 같습니다.
목차 |
반환값
첫 번째 요소로의 역방향 반복자.
복잡도
상수.
참고 사항
반환된 역방향 반복자의 기반 반복자 는 end 반복자 입니다. 따라서 end 반복자가 무효화될 때 반환된 반복자도 함께 무효화됩니다.
libc++ 백포트가
crbegin()
를 C++98 모드로 이식합니다.
예제
#include <algorithm> #include <iostream> #include <string> #include <map> int main() { std::multimap<std::string, int> map { {"█", 1}, {"▒", 5}, {"░", 3}, {"▓", 7}, {"▓", 8}, {"░", 4}, {"▒", 6}, {"█", 2} }; std::cout << "const 역방향 반복자를 사용하여 역순으로 출력:\n"; std::for_each(map.crbegin(), map.crend(), [](std::pair<const std::string, int> const& e) { std::cout << "{ \"" << e.first << "\", " << e.second << " };\n"; }); map.rbegin()->second = 42; // OK: non-const 값은 수정 가능 // map.crbegin()->second = 42; // Error: const 값을 수정할 수 없음 }
가능한 출력:
const 역방향 반복자를 사용하여 역순으로 출력:
{ "▓", 8 };
{ "▓", 7 };
{ "▒", 6 };
{ "▒", 5 };
{ "░", 4 };
{ "░", 3 };
{ "█", 2 };
{ "█", 1 };
참고 항목
|
(C++11)
|
역방향 반복자를 끝 위치로 반환
(public member function) |
|
(C++14)
|
컨테이너나 배열의 시작 위치로 역방향 반복자를 반환
(function template) |