std::basic_string_view<CharT,Traits>::front
cppreference.net에서 가져옴
constexpr const_reference front() const;
|
(C++17 이후) | |
뷰의 첫 번째 문자에 대한 참조를 반환합니다.
|
만약 empty()가 |
(C++26까지) |
|
인 경우:
만약 empty() |
(C++26부터) |
반환값
data_
[
0
]
복잡도
상수.
예제
이 코드 실행
#include <iostream> #include <string_view> int main() { for (std::string_view str{"ABCDEF"}; !str.empty(); str.remove_prefix(1)) std::cout << str.front() << ' ' << str << '\n'; }
출력:
A ABCDEF B BCDEF C CDEF D DEF E EF F F
참고 항목
|
마지막 문자에 접근
(public member function) |
|
|
뷰가 비어 있는지 확인
(public member function) |
|
|
(
DR*
)
|
첫 번째 문자에 접근
(
std::basic_string<CharT,Traits,Allocator>
의 public member function)
|