std::basic_string_view<CharT,Traits>::data (3) - Linux Manuals
std::basic_string_view<CharT,Traits>::data: std::basic_string_view<CharT,Traits>::data
NAME
std::basic_string_view<CharT,Traits>::data - std::basic_string_view<CharT,Traits>::data
Synopsis
constexpr const_pointer data() const noexcept; (since C++17)
Returns a pointer to the underlying character array. The pointer is such that the range [data(); data() + size()) is valid and the values in it correspond to the values of the view.
Parameters
(none)
Return value
A pointer to the underlying character array.
Complexity
Constant.
Notes
Unlike std::basic_string::data() and string literals, data() may return a pointer to a buffer that is not null-terminated. Therefore it is typically a mistake to pass data() to a routine that takes just a const CharT* and expects a null-terminated string.
Example
// Run this code
Output:
See also
front (public member function)
back (public member function)