title: std::vector<std::wstring> Is moving/reallocating inner wstring.data() legal?
body: <p>Here is an excerpt:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>...
  std::vector&lt;std::wstring&gt; vecWstr;
  
  vecWstr.emplace_back(L"1");
  wchar_t* data1 = vecWstr[0].data(); //&lt;-This pointer needed for future use.
  
  vecWstr.emplace_back(L"2");
  wchar_t* data2 = vecWstr[0].data();
  if (data1 != data2)
     MessageBox(L"Error, not equal.", L"Compare");
  </code></pre>
  
  <p><code>MessageBox</code> always arises.<br>
  So, here i compare two <code>wstring</code> buffers before and after<code>.emplace()</code>. In my understanding they must be equal.<br></p>
  
  <p>The main concern here is: Why <code>vector</code> moves/reallocates 1st innner <code>std::wstring</code> element after emplacing a second?<br>
  This question arose after investigation took place after weird program behavior.<br>
  If i save <code>vecWstr[0].data()</code> buffer pointer <strong>before</strong> second <code>.emplace()</code> then buffer pointer becomes obsolete and program behaves inappropriately.<br>
  The biggest issue is that there are a lot of <code>std::vector&lt;std::wstring&gt;</code>'s in a program, but all of them seem to work as expected, and only one so far like showed above.<br>
  This is all in <strong>MSVS 16.1.5</strong>  </p>
  
  <p>The question is:<br>
  Who is right here? Can <code>std::vector</code> change/move the inner buffer of its <code>std::wstring</code> elements or not?</p>