title: C++ convert between Byte vector and wstring
body: <p>I need to process the data stored in wide strings at a low level. I am able to convert to a <code>vector</code> of <code>Bytes</code> with the following method:</p>
  
  <pre><code>typedef unsigned char Byte;
  
  wstring mystring = L"my wide string";
  Byte const *pointer = reinterpret_cast&lt;Byte const*&gt;(&amp;mystring[0]);
  size_t size = mystring.size() * sizeof(mystring.front());
  vector&lt;Byte&gt; byteVector(pointer, pointer + size);
  </code></pre>
  
  <p>However, I am having trouble going the other way; I am not very familiar with casting. How do I convert a <code>vector</code> of <code>Bytes</code> to a <code>wstring</code>?</p>