C ++ 17是否包含const char*
到std::string_view
转换的文字后缀?
auto str = "asdf"s;
上述陈述中str
的类型是std::string
还是std::string_view
?
答案 0 :(得分:22)
如果我们要相信STL's comment,那么是的,我们会根据P0403R0提供字符串视图字面后缀。
如果我理解正确,s
将保留std::string
字面后缀,而std::string_view
将使用sv
。
cout << "Hello, string_view literals!"sv << endl;
cout << "Hello, string literals!"s << endl;
从this commit sv
开始,在标准C ++草案中。