Letter symbol

I don’t know if I missed something or it really doesn’t exist. String literals were added in the C ++ 11 standard :

string s = "\\w\\\\\\w"; // I hope I got that right
string s = R"(\w\\\w)";  // I'm pretty sure I got that right

But all my attempts to use the Raw character literal failed:

constexpr char bslash = R('\'); // error: missing terminating ' character
constexpr char bslash = R'(\)'; // error: 'R' was not declared in this scope

The second attempt is considered a multi-character constant! The only way I found something similar to Raw character literal:

constexpr char slash = *R"(\)"; // All Ok.

But I don't like these notations (dereferencing a string literal to keep a copy of the first element), because it's a mess.

Well, what is the question?

  • Are there literal literals Raw? (I didn’t find anything about them, so I’m pretty sure that they don’t)
    • If They Exist: How Should I Write a Raw Character Literal?
    • : ? , AVOID, ?
+4
1

, ++ 11, , N2442 - Unicode String; . N2146 - Raw String Literals (Revision 1) Beman Dawes, :

( ) , ; , .

- . , , , , , - . , . , , - .

, .

, , - . , , , .

+4

All Articles