When you try to compile such (ill formed) code, there is a mismatch between
TCHAR
(resolved to
char
) and
wstring
.
You may easily verify that trying to compile the following
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector < wchar_t> w { L'h', L'e', L'l', L'l', L'o'};
vector < char > v{ 'h', 'e', 'l', 'l', 'o'};
wstring sw{&w.front()};
wstring sv{&v.front()}; }
The code is
ill formed because it freely mixes
TCHAR
(which can be resolved either to
char
or to
wchar_t
), with
wstring
(which always use
wchar_t
).
As a workaround to fix your original code, you can set (assuming you are using Visual Studio)
"Use Unicode Character Set" in project build options.