Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- #include <sstream>
- namespace patch
- {
- template < typename T > std::string to_string( const T& n )
- {
- std::ostringstream stm ;
- stm << n ;
- return stm.str() ;
- }
- }
- #include <iostream>
- int main()
- {
- std::cout << patch::to_string(1234) << '\n' << patch::to_string(1234.56) << '\n' ;
- }
Add Comment
Please, Sign In to add comment