std::hive<T,Allocator>::rbegin, std::hive<T,Allocator>::crbegin
ja.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
関連項目
| 終端への逆イテレータを返す (パブリックメンバ関数) | |
(C++14以降) |
コンテナまたは配列の先頭への逆イテレータを返す (関数テンプレート) |