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() 와 같습니다.
목차 |
반환값
첫 번째 요소로의 역방향 반복자.
복잡도
상수.
참고 사항
반환된 역방향 반복자의 기반 반복자 는 end 반복자 입니다. 따라서 end 반복자가 무효화될 때 반환된 반복자도 함께 무효화됩니다.
예제
이 코드 실행
#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) |