I have a boost variant of looking like this: typedef boost::variant<int, float, double, long, bool, std::string, boost::posix_time::ptime> variant;
I have a need for being able to convert any of the values in this variant to a std::string, I wondered if there is some template type function I could use to do this?
Or what would be the most effective way?
I would currently implement a bunch of overloaded functions, each taking a type and then doing the conversion using std::stringstream
or for posix_time
i'd use it's conversion function. Perhaps there is a better way?