Visual c++ 在VC6中使用_int64和std::ostringstream 可以知道在Visual C++ 6?< /p>中,使该代码通过的解决方案是什么? #include <sstream> int main() { std::ostringstream ss; ss << 123; __int64 i; // error C2593: 'operator <<' is ambiguous ss << i; } #包括 int main() { std::ostringstream ss; ss

Visual c++ 在VC6中使用_int64和std::ostringstream 可以知道在Visual C++ 6?< /p>中,使该代码通过的解决方案是什么? #include <sstream> int main() { std::ostringstream ss; ss << 123; __int64 i; // error C2593: 'operator <<' is ambiguous ss << i; } #包括 int main() { std::ostringstream ss; ss,visual-c++,Visual C++,为流插入操作提供自定义覆盖 示例实现如下所示 std::ostream& operator<<(std::ostream& stream, __int64 data) { char buf[255] = {0}; _i64tot( data, buf, 10 ); stream << buf; return stream; } std::ostream&operator\u i64tot需要一个TCHAR*,即只有在未定

为流插入操作提供自定义覆盖

示例实现如下所示

std::ostream& operator<<(std::ostream& stream, __int64 data)
{
    char buf[255] = {0};
    _i64tot( data, buf, 10 );

    stream << buf;
    return stream;
}

std::ostream&operator
\u i64tot
需要一个
TCHAR*
,即只有在未定义
\u UNICODE
时,此代码才会编译。您更愿意使用
\u i64toa
来代替。