title: Are wchar_t and char16_t the same thing on Windows?
body: <p>I have an instance of <code>std::u16string</code>, can I pass its <code>c_str()</code> to a Win32 APIs which expects <code>LPCWSTR</code>, without any kind of conversion? For example, can I safely do this:</p>
  
  <pre><code>auto u16s = std::u16string(u"Hello");
  ::SetWindowTextW(hWnd, reinterpret_cast&lt;LPCWSTR&gt;(u16s.c_str()));    
  </code></pre>
  
  <p><em>Updated</em>, MSDN says <a href="https://docs.microsoft.com/en-us/cpp/cpp/char-wchar-t-char16-t-char32-t?view=vs-2017" rel="noreferrer">here</a> <code>wchar_t</code> is UTF-16LE, while <code>char16_t</code> is just UTF-16 with no endian specified. Is it safe to assume then that <code>char16_t</code> is also always UTF-16LE on Windows? Or would that be MSVC compiler specific, and so it can possibly be UTF-32LE (or maybe UTF-16BE) if I complile with GCC, for example?</p>