title: Assigning a "const char*" to std::string is allowed, but assigning to std::wstring doesn't compile. Why?
body: <p>I assumed that std::wstring and std::string both provide more or less the same interface.</p>
  
  <p>So I tried to enable unicode capabilities for our application</p>
  
  <pre><code># ifdef APP_USE_UNICODE
      typedef std::wstring AppStringType;
  # else
      typedef std::string  AppStringType;
  # endif
  </code></pre>
  
  <p>However that gives me a lot of compile errors when -DAPP_USE_UNICODE is used.</p>
  
  <p>It turned out, that the compiler chokes when a <code>const char[]</code> is assigned to <code>std::wstring</code>.</p>
  
  <p><strong>EDIT</strong>: improved example by removing the usage of literal "hello".</p>
  
  <pre><code>#include &lt;string&gt;
  
  void myfunc(const char h[]) {
     string  s = h; // compiles OK
     wstring w = h; // compile Error
  }
  </code></pre>
  
  <p>Why does it make such a difference?</p>
  
  <p>Assigning a  <code>const char*</code> to <code>std::string</code> is allowed, but assigning to <code>std::wstring</code> gives compile errors.</p>
  
  <p>Shouldn't <code>std::wstring</code> provide the same interface as <code>std::string</code>? At least for such a basic operation as assignment?</p>
  
  <p>(environment: gcc-4.4.1 on Ubuntu Karmic 32bit)</p>