G
Gernot Frisch
// THIS CODE:
template<class T> class C
{
public:
C()
{
T t;
data[0] = t;
}
T data[5];
};
int main(int, char**)
{
C<double> c;
return 0;
}
// END CODE
yields error: local variable 't' used without being initialized.
What can I do to make it work with built in variables, initialized as
0?
Must I really specialize for every built in type?
template<class T> class C
{
public:
C()
{
T t;
data[0] = t;
}
T data[5];
};
int main(int, char**)
{
C<double> c;
return 0;
}
// END CODE
yields error: local variable 't' used without being initialized.
What can I do to make it work with built in variables, initialized as
0?
Must I really specialize for every built in type?