Why doesn't std::stringstream work with std::string_view?

The std::stringstream initialization constructor accepts const string& as a parameter: explicit stringstream (const string& str, ios_base::openmode which = ios_base::in | ios_base::out); This interface was reasonable in C++98, but since C++17 we have std::string_view as a cheaper alternative of the class representing a string. The std::stringstream class doesn’t modify the string it accepts, doesn’t own it,… Read More Why doesn't std::stringstream work with std::string_view?

Creating an array of string_view elements throws error: unable to find string literal operator ‘operator""sv’ with

I have the following (modified) code where I want to create an array of string_view type objects. I see this error when compiling corresponding to each line unable to find string literal operator ‘operator""sv’ with ‘const char [8]’, ‘long unsigned int’ arguments "Sensor2"sv, The code: #include <iostream> #include <array> #include <string_view> struct Abc { static… Read More Creating an array of string_view elements throws error: unable to find string literal operator ‘operator""sv’ with