title: What is the fastest method to get "const wchar_t*" from QString
body: <p>I want to pass a <code>QString</code> variable to a function with <code>const wchar_t*</code> argument.</p>
  
  <p>Safe solution is:</p>
  
  <pre><code>void foo(const wchar_t*);
  QString x = "test";
  foo(x.toStdWString().c_str());
  </code></pre>
  
  <p>but it has overhead of converting to <code>wstring</code>. Is there any faster solution?</p>
  
  <p>How about this solution? Is it safe and portable?</p>
  
  <pre><code>foo(reinterpret_cast&lt;const wchar_t*&gt;(x.constData()));
  </code></pre>