template to string


/ Published in: C++
Save to your folder(s)



Copy this code and paste it in your HTML
  1. #include <string>
  2. #include <sstream>
  3.  
  4. template <class T> std::string TToStr( const T &t )
  5. {
  6. std::ostringstream oss;
  7. oss << t;
  8. return std::string (oss.str());
  9. }

Report this snippet


Comments


You need to login to view comments.