std::map<Key,T,Compare,Allocator>:: rend, std::map<Key,T,Compare,Allocator>:: crend
From cppreference.net
C++
Containers library
|
(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 |
std::map
| Member functions | |||||||||||||||||||||||||||
| Non-member functions | |||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||
| Deduction guides (C++17) | |||||||||||||||||||||||||||
|
reverse_iterator rend
(
)
;
|
(1) |
(C++11부터 noexcept)
(C++26부터 constexpr) |
|
const_reverse_iterator rend
(
)
const
;
|
(2) |
(C++11부터 noexcept)
(C++26부터 constexpr) |
|
const_reverse_iterator crend
(
)
const
noexcept
;
|
(3) |
(C++11부터)
(C++26부터 constexpr) |
역방향 * this 의 마지막 요소 다음을 가리키는 역방향 반복자를 반환합니다. 이는 비역방향 * this 의 첫 번째 요소 바로 앞 요소에 해당합니다.
이 반환된 반복자는 단지 센티넬 역할만 합니다. 이것이 dereferenceable 하다는 보장은 없습니다.
목차 |
반환값
마지막 요소 다음에 오는 요소로의 역방향 반복자.
복잡도
상수.
참고 사항
libc++ 백포트가
crend()
를 C++98 모드로 이식합니다.
예제
이 코드 실행
#include <chrono> #include <iomanip> #include <iostream> #include <string_view> #include <map> using namespace std::chrono; int main() { const std::map<year_month_day, int> messages { {February/17/2023, 10}, {February/17/2023, 20}, {February/16/2022, 30}, {October/22/2022, 40}, {June/14/2022, 50}, {November/23/2021, 60}, {December/10/2022, 55}, {December/12/2021, 45}, {April/1/2020, 42}, {April/1/2020, 24} }; std::cout << "Messages received (date order is reversed):\n"; for (auto it = messages.crbegin(); it != messages.crend(); ++it) std::cout << it->first << " : " << it->second << '\n'; }
가능한 출력:
Messages received (date order is reversed): 2023-02-17 : 10 2022-12-10 : 55 2022-10-22 : 40 2022-06-14 : 50 2022-02-16 : 30 2021-12-12 : 45 2021-11-23 : 60 2020-04-01 : 42
참고 항목
|
(C++11)
|
시작 부분을 가리키는 역방향 반복자를 반환합니다
(public member function) |
|
(C++14)
|
컨테이너나 배열의 역방향 끝 반복자를 반환합니다
(function template) |