Re:Rundown of the newest features in C++11 [pdf]
by CamperBob2 on Monday May 27, 2013 @01:59PM
(#5775748)
Hmm, that's ugly. Why are those parens needed?
[ Parent
| on HN ]
Re:Rundown of the newest features in C++11 [pdf]
by bskari on Monday May 27, 2013 @02:51PM
(#5775977)
The parentheses are used as delimeters so that you can use quotes in the literal.
string test = R"(the Star Trek catchphrase "Beam me up, Scotty" did not appear)";
If you want to use quotes in the string, you can add up to 16 chars to the delimiter, but you still have to use the parentheses. string test = R"[de=limiter!(the (Star Trek) catchphrase "Beam me up, Scotty" did not appear)[de=limiter!";
Re:Rundown of the newest features in C++11 [pdf]
by vinkelhake on Monday May 27, 2013 @02:44PM
(#5775931)
You can prefix the left parenthesis with a string. You then repeat that string after the right parenthesis. By doing this you can include sequences in the raw string literal that would have otherwise terminated it.
R"foo(xyz)")foo";