std::basic_string_view (3) - Linux Manuals
std::basic_string_view: std::basic_string_view
NAME
std::basic_string_view - std::basic_string_view
Synopsis
Defined in header <string_view>
template<
class CharT, (since C++17)
class Traits = std::char_traits<CharT>
> class basic_string_view;
The class template basic_string_view describes an object that can refer to a constant contiguous sequence of char-like objects with the first element of the sequence at position zero.
A typical implementation holds only two members: a pointer to constant CharT and a size.
Several typedefs for common character types are provided:
Defined in header <string_view>
Type Definition
std::string_view std::basic_string_view<char>
std::wstring_view std::basic_string_view<wchar_t>
std::u8string_view std::basic_string_view<char8_t> (C++20)
std::u16string_view std::basic_string_view<char16_t>
std::u32string_view std::basic_string_view<char32_t>
Template parameters
CharT - character type
Traits - CharTraits class specifying the operations on the character type. Like for basic_string, Traits::char_type must name the same type as CharT or the program is ill-formed.
Member types
Member type Definition
traits_type Traits
value_type CharT
pointer CharT*
const_pointer const CharT*
reference CharT&
const_reference const CharT&
const_iterator , ConstexprIterator
iterator const_iterator
reverse_iterator const_reverse_iterator
const_reverse_iterator std::reverse_iterator<const_iterator>
size_type std::size_t
difference_type std::ptrdiff_t
Note: iterator and const_iterator are the same type because string views are views into constant character sequences.
All requirements on the iterator types of a Container applies to the iterator and const_iterator types of basic_string_view as well.
Member functions
constructor (public member function)
operator= (public member function)
Iterators
begin (public member function)
cbegin
end (public member function)
cend
rbegin (public member function)
crbegin
rend (public member function)
crend
Element access
operator[] (public member function)
at (public member function)
front (public member function)
back (public member function)
data (public member function)
Capacity