#include <string>
int main()
{
double randDouble = 1245.432;
std::wstring stringDouble = std::to_wstring(randDouble);
}
当我在 Visual Studio 2010 中编译它时,我得到了这个错误
错误 1 错误 C2668: 'std::to_wstring' : 对重载函数 6 的模糊调用
1> 错误 C2668: 'std::to_string' : 对重载函数的模糊调用
1> d:\program files (x86)\microsoft visual studio 10.0\vc\include\string(688): 可能是 'std::string std::to_string(long double)'
1> d:\program files (x86)\microsoft visual studio 10.0\vc\include\string(680): 或 'std::string std::to_string(_ULonglong)'
1> d:\program files (x86)\microsoft visual studio 10.0\vc\include\string(672): 或
'std::string std::to_string(_Longlong)'
有人可以向我解释为什么编译器会感到困惑,我在做什么错吗?