1
0
mirror of https://github.com/moparisthebest/minetest synced 2024-12-23 16:08:51 -05:00

(hopefully) fixed stoi/stof compile problems on vc2010

This commit is contained in:
Perttu Ahola 2011-05-18 22:05:31 +03:00
parent cdfb5345e9
commit ea3c653a8b

View File

@ -800,16 +800,15 @@ inline s32 stoi(const std::string &s, s32 min, s32 max)
return i; return i;
} }
// MSVC2010 includes it's own versions of these
#if !defined(_MSC_VER) || _MSC_VER < 1600
inline s32 stoi(std::string s) inline s32 stoi(std::string s)
{ {
return atoi(s.c_str()); return atoi(s.c_str());
} }
inline s32 stoi(std::wstring s)
{
return atoi(wide_to_narrow(s).c_str());
}
inline float stof(std::string s) inline float stof(std::string s)
{ {
float f; float f;
@ -818,6 +817,13 @@ inline float stof(std::string s)
return f; return f;
} }
#endif
inline s32 stoi(std::wstring s)
{
return atoi(wide_to_narrow(s).c_str());
}
inline std::string itos(s32 i) inline std::string itos(s32 i)
{ {
std::ostringstream o; std::ostringstream o;