UTF-8 language in Visual C ++ 2010

I am trying to read a UTF-8 text file in Visual C ++ 2010 using only the standard library, not the Boost or Windows API. I define the locale as:

std::locale utf8_locale(std::locale(), new std::codecvt_utf8<wchar_t>);

but this leads to the following compiler error:

error C2661: 'std::locale::facet::operator new' : no overloaded function takes 3 arguments
error C2664: 'std::locale::locale(const char *,std::locale::category)' : cannot convert parameter 1 from 'std::locale' to 'const char *'
+5
source share
2 answers

The error occurs in debug mode when the code is used in a file that is placed in the micrsoft Visual C ++ file below the macro.

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

, #define new DEBUG_NEW , . Visual ++ 2010 http://connect.microsoft.com/VisualStudio/feedback/details/683483/mfc-c-fails-to-compile-use-of-codecvt-utf8-in-debug-configuration

+5

FYI, -

std::locale utf8(std::locale(), ::new std::codecvt_utf8<wchar_t>);

,

+3

All Articles