What does 'R' mean in the context of string literals?

我怕爱的太早我们不能终老 提交于 2019-12-02 03:06:02

prefix(optional) R "delimiter( raw_characters )delimiter" (6) (since C++11)

Raw string literal. Used to avoid escaping of any character. Anything between the delimiters becomes part of the string. prefix, if present, has the same meaning as described above.

Example:

const char* s1 = R"foo(
Hello
World
)foo";
//same as
const char* s2 = "\nHello\nWorld\n";

where foo is the delimiter.


In your case, a message would print:

{ "message" : "Hello, World!" ,client" : 1 } 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!