Skip to content

fixed_string: why we need another string type and how to produce a never-dangling string_view

std::fixed_string is currently in review for C++26. std::string, std::string_view, and string literals are currently not valid non-type template parameters (NTTP). std::fixed_string wants to fill that hole. But is that its sole purpose? And what about the string_view returned from fixed_string, it's just a pointer to a char array. Under what circumstances does the string_view dangle?