MagicWinnie

Untitled

Dec 2nd, 2021 (edited)
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include <string>
  2. #include <sstream>
  3.  
  4. namespace patch
  5. {
  6.     template < typename T > std::string to_string( const T& n )
  7.     {
  8.         std::ostringstream stm ;
  9.         stm << n ;
  10.         return stm.str() ;
  11.     }
  12. }
  13.  
  14. #include <iostream>
  15.  
  16. int main()
  17. {
  18.     std::cout << patch::to_string(1234) << '\n' << patch::to_string(1234.56) << '\n' ;
  19. }
Add Comment
Please, Sign In to add comment