itoa isn't a standard function. Since you're using C++ strings, the stringstream class would be a better option because it's standard and far more flexible:
Code:
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
template <typename T>
string
makestr(T thingie)
{
ostringstream sout;
sout<< thingie;
return sout.str();
}
class test {
int a, b;
public:
test(int a_, int b_)
: a(a_)
, b(b_)
{}
friend ostream&
operator<<(ostream& out, const test& t)
{
return out<< t.a <<'/'<< t.b;
}
};
int
main()
{
string s;
s = makestr(10);
cout<< s <<endl;
s = makestr(123.456);
cout<< s <<endl;
test t(4, 5);
s = makestr(t);
cout<< s <<endl;
}