【发布时间】:2021-03-14 08:58:46
【问题描述】:
我总是用std::wstring x(y) 将wchar_t* 转换为wstring
但它在这段代码中不起作用:
wchar_t f = ctoupper(*cp);
std::wstring cc(f);
cp 是wchar_t*
std::wstring cc(f) 行中的错误:
E0289 no instance of constructor "std::basic_string<_Elem, _Traits, _Alloc>::basic_string [with _Elem=wchar_t, _Traits=std::char_traits<wchar_t>, _Alloc=std::allocator<wchar_t>]" matches the argument list
怎么了?
【问题讨论】:
-
你知道你得到的是第一个字符,而不是整个字符串吗?
-
basic_string(string和wstring下的模板)因其大量的成员函数而令人讨厌。尽管如此,还是值得看看它们以获得一个概览。以cppreference.com为例。
标签: c++