template <class Type>
Type stringToNum(const string str) {
istringstream iss(str);
Type num;
iss >> num;
return num;
}
template<typename T> string toString(const T& t) {
ostringstream oss; //创建一个格式化输出流
oss << t; //把值传递如流中
return oss.str();
}
___________________________________________________________________________________________________________________________
原文地址:https://www.cnblogs.com/TheKat/p/9116135.html
时间: 2024-11-04 21:34:43