std::basic_string_view<CharT,Traits>::rbegin, std::basic_string_view<CharT,Traits>::crbegin
cppreference.net에서 가져옴
constexpr const_reverse_iterator rbegin() const noexcept;
|
(C++17부터) | |
constexpr const_reverse_iterator crbegin() const noexcept;
|
(C++17부터) | |
뒤집힌 뷰의 첫 번째 문자를 가리키는 역방향 반복자를 반환합니다. 이는 뒤집히지 않은 뷰의 마지막 문자에 해당합니다.
매개변수
(없음)
반환값
const_reverse_iterator
첫 번째 문자로의 역방향 반복자입니다.
복잡도
상수.
예제
이 코드 실행
#include <algorithm> #include <iostream> #include <iterator> #include <string_view> int main() { std::ostream_iterator<char> out_it(std::cout); std::string_view str_view("abcdef"); std::copy(str_view.rbegin(), std::next(str_view.rbegin(), 3), out_it); *out_it = '\n'; std::copy(str_view.crbegin(), std::next(str_view.crbegin(), 3), out_it); *out_it = '\n'; }
출력:
fed fed
참고 항목
|
역방향 반복자를 끝 위치로 반환
(public member function) |
|
|
(C++11)
|
역방향 반복자를 시작 위치로 반환
(public member function of
std::basic_string<CharT,Traits,Allocator>
)
|