labs-edaf30/lab4/toString.h
2024-12-11 15:54:56 +01:00

10 lines
219 B
C++

#include <sstream>
#include <string>
// Template function to convert an object to a string
template <typename T>
std::string toString(const T& obj) {
std::ostringstream oss;
oss << obj;
return oss.str();
}