below are the codes:
I just want to know what it means?Code:template <class T> string toStr(const T &x){ stringstream s; s << x; return s.str(); } template <class T> int toInt(const T &x){ stringstream s; s << x; int r; s >> r; return r; }
below are the codes:
I just want to know what it means?Code:template <class T> string toStr(const T &x){ stringstream s; s << x; return s.str(); } template <class T> int toInt(const T &x){ stringstream s; s << x; int r; s >> r; return r; }
Those are C++ template functions. They appear to be converting numbers to strings and strings to integers
Jim