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";
string s = R"(\w\\\w)";
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"(\)";
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, ?