原始字符串文字和文件编码 [英] Raw string literals and file codification

查看:163
本文介绍了原始字符串文字和文件编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C ++ 11推出了原始字符串字面值,可以非常有用的代表引用的字符串,有许多特殊符号的文字如Windows文件路径,regex表达式等...

C++11 introduced the raw string literals which can be pretty useful to represent quoted strings, literals with lots of special symbols like windows file paths, regex expressions etc...

std::string path = R"(C:\teamwork\new_project\project1)"; // no tab nor newline!
std::string quoted = R"("quoted string")";
std::string expression = R"([\w]+[ ]+)";

此原始字符串文字也可以与编码前缀( u8 u U L ),但是,当没有指定编码前缀时,文件编码是否重要?,假设我有这个代码:

This raw string literals can also be combined with encoding prefixes (u8, u, U, or L), but, when no encoding prefix is specified, does the file encoding matters?, lets suppose that I have this code:

这篇关于原始字符串文字和文件编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆