SMORES Robot Platform Simulation
Modlab at Penn, ASL at Cornell
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends
util.hh
1 #ifndef _UTIL_HH_
2 #define _UTIL_HH_
3 
4 #include <string>
5 #include <sstream>
7 namespace util
8 {
10 
14 template < typename T > std::string to_string( const T& n )
15 {
16  std::ostringstream stm ;
17  stm << n ;
18  return stm.str() ;
19 }
21 
25 inline string Int2String(int number)
26 {
27  stringstream ss; //create a stringstream
28  ss << number; //add number to the stream
29  return ss.str(); //return a string with the contents of the stream
30 } // Int2String
31 }
32 
33 #endif
util namespace defines a bunch of utility functions
Definition: util.hh:7
string Int2String(int number)
Converts int to string.
Definition: util.hh:25
std::string to_string(const T &n)
A function template that convert number to string.
Definition: util.hh:14