Namespaces
Variants

std::inplace_vector<T,N>::rbegin, std::inplace_vector<T,N>::crbegin

출처: ko.cppreference.net

 
 
 
 
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부터)

역방향으로 뒤집힌 inplace_vector의 첫 번째 요소를 가리키는 역방향 반복자를 반환합니다. 이는 뒤집히지 않은 inplace_vector의 마지막 요소에 해당합니다. inplace_vector이 비어 있으면 반환된 반복자는 rend()와 같습니다.

반환값

첫 번째 요소로의 역방향 반복자.

복잡도

상수.

참고 사항

반환된 역방향 반복자의 기반 반복자 는 end 반복자 입니다. 따라서 end 반복자가 무효화될 때 반환된 반복자도 함께 무효화됩니다.

예제

#include <algorithm>
#include <iostream>
#include <string>
#include <string_view>
#include <inplace_vector>

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)
컨테이너나 배열의 시작 위치로 역방향 반복자를 반환합니다
(function template)