Namespaces
Variants

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

来自 zh.cppreference.net

 
 
 
 
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

参阅

返回指向末端(end)的反向迭代器
(公开成员函数)
(C++14)
返回指向容器或数组起始(beginning)的反向迭代器
(函数模板)