Is there a way to infer the type of the list in order to avoid having to pass the type of the argument that should be in the list, just infer it from the first type of element.
template<typename T, T... Args> struct Calc { // do stuff with Args }; // Usage: Calc<int, 1, 2, 3>::value; typename<T... Args> Calc { }; // error T undefined // Desired: Calc<1, 2, 3>::value; // auto deduced T = int Calc<1.0f, 2.0f, 3.0f>::value; // auto deduced T = float
Is there a way to get the desired behavior, or should I include this type as a parameter?
source share