Any basic type ToString





10
Date Submitted Tue. Aug. 8th, 2006 1:19 AM
Revision 1 of 1
Beginner ciorga
Tags CPlusPlus | float | int | toString
Comments 1 comments
Transform any basic type to string. Very handy for log messages

Usage:

int i(12);
float j(3.14);
cout
#include <sstream>
#include <string>

template <class T>
std::string ToString (const T& val)
{
    std::stringstream strm;
    strm << val;
    return strm.str ();
}
 

Cristian Iorga

Comments

Comments itoa()
Mon. Oct. 9th, 2006 6:20 AM    Helper shell

Voting