gpt4 book ai didi

c++ - 为什么/如何将非宽字符串传递给 wstringstream::operator<<?

转载 作者:行者123 更新时间:2023-11-30 05:49:21 26 4
gpt4 key购买 nike

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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com