Monday, November 06, 2006

a neat ToString for c++




template <class T>
string to_string(T toBeConverted){

// create an out string stream
ostringstream buffer;
// write the value to be converted to the output stream
buffer << toBeConverted;
// get the string value
return buffer.str();
}