title: Cross-platform way to convert UTF8 to std::wstring
body: <blockquote>
  <p><strong>Possible Duplicate:</strong><br />
  <a href="http://stackoverflow.com/questions/148403/utf8-to-from-wide-char-conversion-in-stl">UTF8 to/from wide char conversion in STL</a></p>
  </blockquote>
  
  <p>I know how to convert UTF8 to std::wstring using <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd319072%28v=vs.85%29.aspx" rel="nofollow noreferrer">MultiByteToWideChar</a>:</p>
  <pre><code>std::wstring utf8to16( const char* src )
  {
      std::vector&lt;wchar_t&gt; buffer;
      buffer.resize(MultiByteToWideChar(CP_UTF8, 0, src, -1, 0, 0));
      MultiByteToWideChar(CP_UTF8, 0, src, -1, &amp;buffer[0], buffer.size());
      return &amp;buffer[0];
  }
  </code></pre>
  <p>but it is Windows-specific, is there a cross-platform C++ function that does the same thing, using only stdio or iostream?</p>