Namespaces
Variants
Actions

std::basic_string_view

From cppreference.com
< cpp‎ | string
 
 
Strings library
Classes
basic_string_view
(C++17)
 
 
Defined in header <string_view>
template<

    class CharT,
    class Traits = std::char_traits<CharT>

> class basic_string_view;
(since C++17)

The class template basic_string_view describes an object that can refer to a constant contiguous sequence of CharT with the first element of the sequence at position zero.

For a basic_string_view str, pointers, iterators, and references to elements of str are invalidated when an operation invalidates a pointer in the range [str.data()str.data() + str.size()).

Every specialization of std::basic_string_view is a TriviallyCopyable type.

(since C++23)

Several typedefs for common character types are provided:

Defined in header <string_view>
Type Definition
std::string_view (C++17) std::basic_string_view<char>
std::wstring_view (C++17) std::basic_string_view<wchar_t>
std::u8string_view (C++20) std::basic_string_view<char8_t>
std::u16string_view (C++17) std::basic_string_view<char16_t>
std::u32string_view (C++17) std::basic_string_view<char32_t>

Contents