Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. #ifdef __MINGW32__
  2. /*
  3. Shitty hack because mingw32 does not support this functionality yet
  4. */
  5. namespace std
  6. {
  7. template <class T> std::string to_string(T val)
  8. {
  9. std::stringstream ss;
  10. ss << val;
  11. return ss.str();
  12. }
  13.  
  14. int stoi(std::string str)
  15. {
  16. std::stringstream ss;
  17. int ret;
  18. ss << str;
  19. ss >> ret;
  20. return ret;
  21. }
  22.  
  23. long stol(std::string str)
  24. {
  25. std::stringstream ss;
  26. long ret;
  27. ss << str;
  28. ss >> ret;
  29. return ret;
  30. }
  31.  
  32. float stof(std::string str)
  33. {
  34. std::stringstream ss;
  35. float ret;
  36. ss << str;
  37. ss >> ret;
  38. return ret;
  39. }
  40.  
  41. double stod(std::string str)
  42. {
  43. std::stringstream ss;
  44. double ret;
  45. ss << str;
  46. ss >> ret;
  47. return ret;
  48. }
  49. }
  50. #endif // __MINGW32__
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement