小编Mic*_*l J的帖子

std :: basic_stringstream <unsigned char>将无法使用MSVC 10进行编译

我试图让UTF-8字符与ANSI 8位字符共存.我的策略是表示utf-8字符,unsigned char以便可以对两种字符类型使用适当的函数重载.

例如

    namespace MyStuff
    {
        typedef uchar utf8_t;
        typedef std::basic_string<utf8_t> U8string;
    }
    void SomeFunc(std::string &s);
    void SomeFunc(std::wstring &s);
    void SomeFunc(MyStuff::U8string &s);
Run Code Online (Sandbox Code Playgroud)

这一切都很好,直到我尝试使用stringstream.

    std::basic_ostringstream<MyStuff::utf8_t> ostr;
    ostr << 1;
Run Code Online (Sandbox Code Playgroud)

MSVC Visual C++ Express V10无法编译:

c:\program files\microsoft visual studio 10.0\vc\include\xlocmon(213): 
    warning C4273: 'id' : inconsistent dll linkage
    c:\program files\microsoft visual studio 10.0\vc\include\xlocnum(65) : 
            see previous definition of 
            'public: static std::locale::id std::numpunct<unsigned char>::id'
    c:\program files\microsoft visual studio 10.0\vc\include\xlocnum(65) : 
            while compiling class template static data member 'std::locale::id 
            std::numpunct<_Elem>::id'
    with
    [ …
Run Code Online (Sandbox Code Playgroud)

c++ unicode stringstream utf-8 visual-c++

7
推荐指数
0
解决办法
1758
查看次数

标签 统计

c++ ×1

stringstream ×1

unicode ×1

utf-8 ×1

visual-c++ ×1