Top "String-view" questions

A string_view is a C++ class template that is a non-owning reference to a string.

What is string_view?

string_view was a proposed feature within the C++ Library Fundamentals TS(N3921) added to C++17 As far as i …

c++ c++17 string-view fundamentals-ts
How exactly is std::string_view faster than const std::string&?

std::string_view has made it to C++17 and it is widely recommended to use it instead of const std::…

c++ string c++17 string-view
How you convert a std::string_view to a const char*?

Compiling with gcc-7.1 with the flag -std=c++17, the following program raises an error: #include <string_view> void …

c++ string c++17 string-view
Why is there no implicit conversion from std::string_view to std::string?

There is an implicit conversion from std::string to std::string_view and it's not considered unsafe, even though this …

c++17 string-view
How to correctly create std::string from a std::string_view?

I have a class: class Symbol_t { public: Symbol_t( const char* rawName ) { memcpy( m_V, rawName, 6 * sizeof( char ) ); }; string_…

c++ string reference iterator string-view
Use of string_view for map lookup

The following code fails to build on recent compilers (g++-5.3, clang++-3.7). #include <map> #include <functional&…

c++ dictionary c++14 string-view
Why is there no support for concatenating std::string and std::string_view?

Since C++17, we have std::string_view, a light-weight view into a contiguous sequence of characters that avoids unnecessary copying …

c++ string c++17 string-view
Differences between boost::string_ref and boost::string_view

Boost provides two different implementations of string_view, which will be a part of C++17: boost::string_ref in utility/…

boost string-view
How to convert std::string_view to double?

I'm writing a c++ parser for a custom option file for an application. I have a loop that reads lines …

c++ c++17 string-view
Safely convert std::string_view to int (like stoi or atoi)

Is there a safe standard way to convert std::string_view to int? Since C++11 std::string lets us use …

c++ string c++17 atoi string-view