I'm learning about raw strings in C++ from a cplusplus.com tutorial on constants. Based on the definition on that site, a raw string should start with R"sequence(
and end with )sequence
where sequence
can be any sequence of characters.
One of the examples of the website is the following:
R"&%$(string with \backslash)&%$"
However, when I try to compile the code that contains the above raw string, I get a compilation error.
test.cpp:5:28: error: invalid character '$' in raw string delimiter
5 | std::string str = R"&%$(string with \backslash)&%$";
| ^
test.cpp:5:23: error: stray 'R' in program
I tried it with g++ and clang++ on both Windows and Linux. None of them worked.