Last Updated: June 6, 2026
std::string_view is a non-owning, read-only view over a sequence of characters that lives somewhere else (C++17). It is a pair of (pointer, length) that points into a std::string, a string literal, a char array, or any other contiguous run of characters. It provides the read-only API of a string without paying for a copy. The header is <string_view>, and the type lives in namespace std.