I use R"(...)"
to define a raw string but, if the string actually contains a raw string terminator )"
, the compiler will complain.
For example:
auto tag = R"("(add)")"; // try to get string <"(add)">
How can I modify this so it works?
The syntax for a raw string literal is something like the following:
R"<delim>(...)<delim>"
The optional delimiter that is next to the parentheses is there exactly for the reason you just stumbled upon. It's to let you include the raw string's control characters inside the literal. So add a delimiter:
auto tag = R"tag("("add")")tag";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With