Wednesday, August 16, 2017

C++11: Raw String Literals

If you have a lot of characters that need to be escaped, you can use raw string literals to simplify a string. Here is an example:

#include <iostream>
int main()
{
  std::cout << R"(\\\\\)" << std::endl;
  return 0;
}
// Output: \\\\\
Reference: https://isocpp.org/wiki/faq/cpp11-language-misc#raw-strings

No comments:

Post a Comment