I have the following template class :
template <typename T>
struct timer
{
T period;
timer(T p) :
period(p)
{}
};
To instantiate it I need to do :
timer<double> t(double(0.0));
Is is possible to improve timer
's class definition to allow this syntax :
timer t(double(0.0));
and have the compiler infer the double
type from the constructor's argument ?