我还没有使用C++ 11,所以我to_string(whatever)自己编写了这些函数.只有在它们不存在时才应编译它们.如果我切换到C++ 11,应该跳过它们.我有这样的事情:
#ifndef to_string
string to_string(int a){
string ret;
stringstream b;
b << a;
b >> ret;
return ret;
}
string to_string(double a){
string ret;
stringstream b;
b << a;
b >> ret;
return ret;
}
#endif
Run Code Online (Sandbox Code Playgroud)
这显然不起作用.这样的事情是可能的,如果是的话,怎么样?