daily pastebin goal
5%
SHARE
TWEET

Untitled

a guest Aug 14th, 2018 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <tchar.h>
  2.  
  3. typedef TCHAR Char;
  4.  
  5. typedef std::basic_string<Char> String;
  6.  
  7. template<typename C, typename T>
  8. std::basic_string<C> InternalToString(T val);
  9.  
  10. template<typename T>
  11. inline std::string InternalToString<char, T>(T val)
  12. {
  13.     return std::to_string(val);
  14. }
  15.  
  16. template<typename T>
  17. inline std::wstring InternalToString<wchar_t, T>(T val)
  18. {
  19.     return std::to_wstring(val);
  20. }
  21.  
  22. template<typename T>
  23. inline String ToString(T val)
  24. {
  25.     return InternalToString<Char, T>(val);
  26. }
  27.    
  28. template<typename C, typename T>
  29. inline std::enable_if_t<std::is_same_v<C, char>, std::string> InternalToString(T val)
  30. {
  31.     return std::to_string(val);
  32. }
  33.  
  34. template<typename C, typename T>
  35. inline std::enable_if_t<std::is_same_v<C, wchar_t>, std::wstring> InternalToString(T val)
  36. {
  37.     return std::to_wstring(val);
  38. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top