If I have a multi-line string C++11 string constant such as
R\"\"\"line 1
line 2
line3\"\"\"
Is it defined what character(s) the line termi
The standard seems to indicate that:
R"""line 1
line 2
line3"""
is equivalent to:
"line 1\nline 2\nline3"
From 2.14.5 String literals of the C++11 standard:
4 [ Note: A source-file new-line in a raw string literal results in a new-line in the resulting execution string literal. Assuming no whitespace at the beginning of lines in the following example, the assert will succeed:
const char *p = R"(a\ b c)"; assert(std::strcmp(p, "a\\\nb\nc") == 0);
—end note ]
5 [ Example: The raw string
R"a( )\ a" )a"
is equivalent to
"\n)\\\na\"\n"
.