std::multiset<Key,Compare,Allocator>:: rend, std::multiset<Key,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::multiset
| 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 第一个元素之前的位置。
此返回的迭代器仅作为哨兵使用。不保证其具有 可解引用性 。
目录 |
返回值
指向最后一个元素之后元素的反向迭代器。
复杂度
常量。
注释
由于
iterator
和
const_iterator
都是常量迭代器(实际上可能是同一类型),因此无法通过这些成员函数返回的迭代器来修改容器中的元素。
libc++ 向后移植
crend()
至 C++98 模式。
示例
运行此代码
#include <iostream> #include <set> int main() { std::multiset<unsigned> rep{1, 2, 3, 4, 1, 2, 3, 4}; for (auto it = rep.crbegin(); it != rep.crend(); ++it) { for (auto n = *it; n > 0; --n) std::cout << "⏼" << ' '; std::cout << '\n'; } }
输出:
⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼
另请参阅
|
(C++11)
|
返回指向起始位置的反向迭代器
(公开成员函数) |
|
(C++14)
|
返回容器或数组的反向末尾迭代器
(函数模板) |