Templates with default types
Consider this structure:
Code:
template<class T = double>
struct Vector
{
Vector()
{
x = T(0);
y = T(0);
}
...
T x;
T y;
}
To create a structure you type:
Code:
Vector<float> v1;
Vector<> v2; //T = double
However the <> is still needed even when using the default type. From a pedantic and visual standpoint I really find this ugly. Is there any way to make this work:
Code:
Vector<float> v1;
Vector v2; //T = double
(without typedefing and appending letters like Vectorf, Vectord, Vectori etc...)
?