这些运算符在命名空间中声明。std::literals::string_view_literals,两者都是literals和string_view_literals是内联命名空间。可以通过以下方式访问这些操作员using namespace std::literals,,,using namespace std::string_view_literals,和using namespace std::literals::string_view_literals... ...
usingnamespacestd::literals usingnamespacestd::string_view_literals usingnamespacestd::literals::string_view_literals 示例 运行此代码 #include <iostream>#include <string_view>#include <typeinfo>voidprint_each_character(conststd::string_viewsw){for(charc:sw)std::cout<<(c=='\0'?'@':c);std...
Access to these operators can be gained with using namespace std::literals, using namespace std::string_view_literals, and using namespace std::literals::string_view_literals. S Ssv (since C++17)
usingnamespacestd::string_view_literals, or usingnamespacestd::literals::string_view_literals. Example Run this code #include <iostream>#include <string_view>#include <typeinfo>voidprint_each_character(conststd::string_viewsw){for(charc:sw)std::cout<<(c=='\0'?'@':c);std::cout<<'\...