Is there something equivariant in C ++ (or C ++ 11) for @, as in C #?

In C #, we can define a complex string with @:

string str = @"This is the first line.\r\nThis is still the first line";

like in c ++? if we have something like this, we don’t need to use the '\' sign conversion for all special characters.

+4
source share
1 answer

In C ++ 11 (only), you can use a string literal:

std::string str = R"(This is the first line.\r\nThis is still the first line)";
+5
source

All Articles