Namespaces
Variants

std::basic_string_view<CharT,Traits>:: begin, std::basic_string_view<CharT,Traits>:: cbegin

From cppreference.net
constexpr const_iterator begin ( ) const noexcept ;
(C++17부터)
constexpr const_iterator cbegin ( ) const noexcept ;
(C++17부터)

뷰의 첫 번째 문자에 대한 반복자를 반환합니다.

range-begin-end.svg

목차

매개변수

(없음)

반환값

const_iterator 첫 번째 문자에 대한 반복자입니다.

복잡도

상수.

예제

#include <concepts>
#include <string_view>
int main()
{
    constexpr std::string_view str_view("abcd");
    constexpr auto begin = str_view.begin();
    constexpr auto cbegin = str_view.cbegin();
    static_assert(
        *begin == 'a' and
        *cbegin == 'a' and
        *begin == *cbegin and
        begin == cbegin and
        std::same_as<decltype(begin), decltype(cbegin)>);
}

참고 항목

끝을 가리키는 반복자를 반환합니다
(public member function)
시작을 가리키는 반복자를 반환합니다
( std::basic_string<CharT,Traits,Allocator> 의 public member function)