Will C++17 contain a literal suffix for const char*
to std::string_view
conversion?
auto str = "asdf"s;
Will the type of str
in the above statement be std::string
or std::string_view
?
If we're to believe STL's comment, then yes, we'll have string view literal suffixes based on, I believe, P0403R0.
If I understand things correctly s
will stay a std::string
literal suffix, while std::string_view
will use sv
.
cout << "Hello, string_view literals!"sv << endl;
cout << "Hello, string literals!"s << endl;
As of this commit sv
is in the Standard C++ draft.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With