wstring ss;
ss << L"Some wide-char text" << " and some non-wide-char text";
这似乎工作得很好,但为什么当 char_type
不是 char
时呢?
最佳答案
无论模板的 CharT
是什么,所有流都有 char
的重载。
http://en.cppreference.com/w/cpp/io/basic_ostream/operator_ltlt2
template< class CharT, class Traits >
basic_ostream<CharT,Traits>& operator<<( basic_ostream<CharT,Traits>& os,
const char* s );
关于c++ - 为什么/如何将非宽字符串传递给 wstringstream::operator<<?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27778312/