std::hive<T,Allocator>::rbegin, std::hive<T,Allocator>::crbegin

来自cppreference.com
 
 
 
 
reverse_iterator rbegin() noexcept;
(1) (C++26 起)
const_reverse_iterator rbegin() const noexcept;
(2) (C++26 起)
const_reverse_iterator crbegin() const noexcept;
(3) (C++26 起)

返回指向逆向的 hive 的首元素的逆向迭代器。它对应非逆向 hive 的末元素。如果 hive 为空,那么返回的迭代器等于 rend()

返回值

指向首元素的逆向迭代器。

复杂度

常数。

注解

返回的逆向迭代器的底层迭代器尾迭代器。因此在尾迭代器失效时,返回的迭代器也会失效。

示例

#include <algorithm>
#include <hive>
#include <iostream>
#include <iterator>

int main()
{
    const std::hive<int> hive{1, 2, 3, 4, 5};
    std::copy(hive.rbegin(), hive.rend(), std::ostream_iterator<int>(std::cout, " "));
    std::cout << '\n';
}

输出:

5 4 3 2 1

参阅

返回指向末尾的逆向迭代器
(公开成员函数) [编辑]
返回指向一个容器或数组的逆向迭代器
(函数模板) [编辑]
Morty Proxy This is a proxified and sanitized view of the page, visit original site.