std::inplace_vector<T,N>:: rbegin, std::inplace_vector<T,N>:: crbegin
From cppreference.net
<
cpp
|
container
|
inplace vector
|
constexpr
reverse_iterator rbegin
(
)
noexcept
;
|
(1) | (C++26以降) |
|
constexpr
const_reverse_iterator rbegin
(
)
const
noexcept
;
|
(2) | (C++26以降) |
|
constexpr
const_reverse_iterator crbegin
(
)
const
noexcept
;
|
(3) | (C++26以降) |
反転された * this の最初の要素を指す逆方向イテレータを返します。これは非反転 * this の最後の要素に対応します。
* this が空の場合、返されるイテレータは rend() と等しくなります。
目次 |
戻り値
最初の要素への逆方向イテレータ。
計算量
定数。
注記
返される逆イテレータの 基盤イテレータ は 終端イテレータ です。したがって、終端イテレータが無効化された場合、返されるイテレータも無効化されます。
例
このコードを実行
#include <algorithm> #include <inplace_vector> #include <iostream> #include <string> #include <string_view> void print(const std::string_view s) { std::cout << s << ' '; } int main() { const std::inplace_vector<std::string_view, 8> data { "▁", "▂", "▃", "▄", "▅", "▆", "▇", "█" }; std::inplace_vector<std::string, 8> arr(8); std::copy(data.cbegin(), data.cend(), arr.begin()); print("Print “arr” in direct order using [cbegin, cend):\t"); std::for_each(arr.cbegin(), arr.cend(), print); print("\n\nPrint “arr” in reverse order using [crbegin, crend):\t"); std::for_each(arr.crbegin(), arr.crend(), print); }
出力:
Print “arr” in direct order using [cbegin, cend): ▁ ▂ ▃ ▄ ▅ ▆ ▇ █ Print “arr” in reverse order using [crbegin, crend): █ ▇ ▆ ▅ ▄ ▃ ▂ ▁
関連項目
|
末尾を指す逆イテレータを返す
(public member function) |
|
|
(C++14)
|
コンテナまたは配列の先頭を指す逆イテレータを返す
(function template) |