title: Convert std::basic_string<wchar_t> and std::basic_string<uint16_t>
body: <p>In MacOS X 10.10 CLang:</p>
  
  <pre><code>typedef basic_string&lt;char, char_traits&lt;char&gt;, allocator&lt;char&gt; &gt; string;
  typedef basic_string&lt;wchar_t, char_traits&lt;wchar_t&gt;, allocator&lt;wchar_t&gt; &gt; wstring;
  </code></pre>
  
  <p>I build a string like:
  std::wstringstream ss;</p>
  
  <pre><code>ss &lt;&lt; "[";
  ss &lt;&lt; "{";
  ss &lt;&lt; "x1:" &lt;&lt; 111 &lt;&lt; ",";
  ss &lt;&lt; "z1:" &lt;&lt; 111;
  ss &lt;&lt; "},";
  ss &lt;&lt; "{";
  ss &lt;&lt; "x2:" &lt;&lt; 222 &lt;&lt; ",";
  ss &lt;&lt; "z2:" &lt;&lt; 222;
  ss &lt;&lt; "}";
  ss &lt;&lt; "]";
  std::wstring str = ss.str();
  </code></pre>
  
  <p>and need to pass <code>str</code> as argument to a function that expects <code>std::basic_string&lt;uint16_t&gt;</code> and returns string of the same type.</p>
  
  <p>How to do conversion between <code>std::basic_string&lt;wchar_t&gt;</code> and  <code>std::basic_string&lt;uint16_t&gt;</code> to make use of the external library function?</p>
  
  <p>C++11 is allowed.</p>
  
  <p>Maybe some use of <code>wstring_convert</code> or some workaround?</p>