Possible Duplicate:
std::to_string – more than instance of overloaded function matches the argument list
#include <string>
int main()
{
double randDouble = 1245.432;
std::wstring stringDouble = std::to_wstring(randDouble);
}
When I compile this in Visual Studio 2010 I get this error
Error 1 error C2668: ‘std::to_wstring’ : ambiguous call to overloaded
function 61> error C2668:
‘std::to_string’ : ambiguous call to overloaded function1> d:\program files (x86)\microsoft visual studio
10.0\vc\include\string(688): could be ‘std::string std::to_string(long double)’1> d:\program files (x86)\microsoft visual studio
10.0\vc\include\string(680): or ‘std::string std::to_string(_ULonglong)’1> d:\program files
(x86)\microsoft visual studio 10.0\vc\include\string(672): or
‘std::string std::to_string(_Longlong)’
Can someone please explain to me why the compiler is confused and what am I doing wrong?
This was a bug in Visual C++ 2010. It has been fixed in Visual C++ 2012.