std::inplace_vector<T,N>:: rend, std::inplace_vector<T,N>:: crend
From cppreference.net
<
cpp
|
container
|
inplace vector
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::inplace_vector
| Member types | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Member functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Non-member functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
constexpr
reverse_iterator rend
(
)
noexcept
;
|
(1) | (自 C++26 起) |
|
constexpr
const_reverse_iterator rend
(
)
const
noexcept
;
|
(2) | (自 C++26 起) |
|
constexpr
const_reverse_iterator crend
(
)
const
noexcept
;
|
(3) | (自 C++26 起) |
返回一个反向迭代器,指向反转后 * this 的最后一个元素之后的位置。它对应于非反转 * this 的第一个元素之前的位置。
此返回的迭代器仅作为哨兵使用。不保证其具有 可解引用性 。
目录 |
返回值
指向最后一个元素之后元素的反向迭代器。
复杂度
常量。
示例
运行此代码
#include <algorithm> #include <iostream> #include <inplace_vector> int main() { std::inplace_vector<int, 11> a{1, 11, 11, 35, 0, 12, 79, 76, 76, 69, 40}; // 使用常量反向迭代器以逆序打印容器元素 std::for_each(a.crbegin(), a.crend(), [](int e){ std::cout << e << ' '; }); std::cout << '\n'; // 使用非常量反向迭代器修改容器中的每个元素 std::for_each(a.rbegin(), a.rend(), [](int& e){ e += 32; }); // 使用常量反向迭代器以字符形式逆序打印元素 std::for_each(a.crbegin(), a.crend(), [](char e){ std::cout << e; }); std::cout << '\n'; }
输出:
40 69 76 76 79 12 0 35 11 11 1 Hello, C++!
另请参阅
|
返回指向起始位置的反向迭代器
(公开成员函数) |
|
|
(C++14)
|
返回容器或数组的反向末尾迭代器
(函数模板) |