say I have a function that converts string to numeric type as below
template<class T>
T to_t(const std::string& str) {
return boost::lexical_cast<T>(str);
}
and I want to make the function being able to convert numeric str to std::chrono::duration, so I can write code like to_t<std::chrono::seconds>("1234") to_t<std::chrono::nanoseconds>("1234")
I wanted to implement this using concepts, but can't figure out how to write constraints for types that are std::chrono::duration as this is a class with template parameters.
if concepts is not applicable here, what's the recommended way to implement this function for std::chrono::duration? thanks