emplace_back different definitions

258 Views Asked by At

I'm using emplace_back function in a cpp project in visual studio and it works correctly. Visual studio shows following definition for it:

void std::vector<std::string>::emplace_back<CHAR(&)[1]>(CHAR(&_Val)[1])

Then, I'm going to move my cpp project files to a MFC project and use them in a dialog based app. When I moved codes to MFC project, emplace_back definition has changed to:

void std::vector<std::string>::emplace_back<WCHAR(&)[1]>(WCHAR(&_Val)[1])

And it leads to C2664 Error in xmemory0 after build:

Error   C2664
std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string(const std::basic_string<char, std::char_traits<char>, std::allocator<char>> &)':
cannot convert argument 1 from 'WCHAR [1]' to 'std::initializer_list<_Elem>'

And in output it says:

note: see reference to function template instantiation 'void std::vector<std::string,std::allocator<_Ty>>::emplace_back<WCHAR(&)[1]>(WCHAR (&)[1])' being compiled
1>          with
1>          [
1>              _Ty=std::string
1>          ]

How can I deal with such problems? Is there any option in properties of Visual Studio Project to correct?

Thanks

0

There are 0 best solutions below