std::basic_string_view<CharT,Traits>:: rend, std::basic_string_view<CharT,Traits>:: crend
From cppreference.net
<
cpp
|
string
|
basic string view
|
constexpr
const_reverse_iterator rend
(
)
const
noexcept
;
|
(C++17 이후) | |
|
constexpr
const_reverse_iterator crend
(
)
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(), str_view.rend(), out_it); *out_it = '\n'; std::copy(str_view.crbegin(), str_view.crend(), out_it); *out_it = '\n'; }
출력:
fedcba fedcba
참고 항목
|
역방향 반복자를 시작 부분에 반환합니다
(public member function) |
|
|
(C++11)
|
역방향 반복자를 끝 부분에 반환합니다
(
std::basic_string<CharT,Traits,Allocator>
의
public member function)
|