0

In C++ 11, you can create a raw string like this

string rawString = R"delim(STRING_WITH_SPECIAL_CHARACTERS)delim";  

It will ignore all the special characters. However, this feature is not implemented in GCC 4.4 or older. Is there a boost equivalent for this feature? If not, what is the best way to create a raw string in an older version of C++ implementation.

Thanks.

ZhouningMan
  • 77
  • 2
  • 8

1 Answers1

0

Raw String literals is a core language feature that cannot be implemented in any library. Basically, because the C++ standard specifies how string literal should be parsed. There may be compiler specific extensions though. But, there is no portable way to do Raw strings pre - C++11.

Even in C++11 and beyond that we have Raw string literals, its a Core language feature whose syntax and semantics is dictated by the standard. In brief, its a compile time feature. Your question can be also likened to something like replicating C++14 constexpr features using normal C++03.

what is the best way to create a raw string in an older version of C++ implementation?

See this question and its answers, it may be helpful

Community
  • 1
  • 1
WhiZTiM
  • 21,207
  • 4
  • 43
  • 68