std::set<Key,Compare,Allocator>::rend, std::set<Key,Compare,Allocator>::crend
来自 cppreference.cn
reverse_iterator rend(); |
(1) | (noexcept since C++11) |
const_reverse_iterator rend() const; |
(2) | (noexcept since C++11) |
const_reverse_iterator crend() const noexcept; |
(3) | (since C++11) |
返回指向反向 set
中最后一个元素之后元素的逆向迭代器。它对应于非反向 set
中第一个元素之前的元素。此元素充当占位符,尝试访问它会导致未定义的行为。
目录 |
[编辑] 返回值
指向最后一个元素之后元素的逆向迭代器。
[编辑] 复杂度
常数。
注意
因为 iterator
和 const_iterator
都是常量迭代器(并且实际上可能是相同的类型),所以无法通过这些成员函数返回的迭代器来修改容器的元素。
libc++ 向后移植 crend()
到 C++98 模式。
[编辑] 示例
运行此代码
输出
⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼ ⏼
[编辑] 参见
(C++11) |
返回指向开头的逆向迭代器 (公共成员函数) |
(C++14) |
返回容器或数组的逆向结束迭代器 (函数模板) |