5

In C# we can define a complicated string with @:

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

how about in C++? if we have something like this we don't need to use converting sign '\' for all the special characters.

diwatu
  • 5,641
  • 5
  • 38
  • 61
  • 2
    Yes, raw string literals. http://stackoverflow.com/questions/10501599/define-stdstring-in-c-without-escape-characters/10501649#10501649 – chris Dec 11 '13 at 00:31

1 Answers1

6

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

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