title: How to implement C++ raw string literals in VIsual C++ 2010?
body: <p>As you may already know, new string literals in C++ 11 can be expressed in a very flexible way.</p>
  
  <p><code>R"&lt;delim&gt;...&lt;delim&gt;";</code> - in this code the <code>&lt;delim&gt;</code> can be pretty much everything and also no escape characters are needed. Any kind of parentheses can be used to delimit the end of string, Raw string literals are especially useful when defining regular expressions:</p>
  
  <p><code>R"(I love those who yearn for the impossible. (Von Goethe, "Faust"))";</code></p>
  
  <p>Blocks of text can be simply defined using equal occurrences of same characters:</p>
  
  <p><code>R";***************************(
    ; TINY BASIC FOR INTEL 8080<br>
    ;       VERSION 2.0<br>
    ;     BY LI-CHEN WANG<br>
    ; MODIFIED AND TRANSLATED<br>
    ;    TO INTEL MNEMONICS<br>
    ;     BY ROGER RAUSKOLB<br>
    ;     10 OCTOBER, 1976<br>
    ;       @COPYLEFT<br>
    ;  ALL WRONGS RESERVED      )
    ;***************************";</code></p>
  
  <p>More information can be found <a href="http://en.wikipedia.org/wiki/C++0x#New_string_literals" rel="nofollow noreferrer">here</a> (Wikipedia). </p>
  
  <p>I want to implement it with C++ processor, here is what I have. Now double quotation marks are not supported, and I need to compete it like C++ 11. Can anyone help me?</p>
  
  <pre><code>#define STR(a) #a
  #define R(var, re)  static char var##_[] = STR(re);\
  const char * var = ( var##_[ sizeof(var##_) - 2] = '\0',  (var##_ + 1) );
  </code></pre>
  
  <p>You can use it like this:</p>
  
  <pre><code>R(re, "\w\d");//It's OK, no warnings.
  </code></pre>
  
  <p>The code is not friendly to use. So I want the feature like C++ 11 raw string literals.</p>
  
  <p>PS: I'm using Visual C++ 2010, the new feature is not supported, I must implement it by myself.</p>