Hi all,
I am having trouble with class definition with template. The following is a simple example:
Code:
template <class DataType>
struct TestStruct {
DataType key;
};
template <class s, class d>
class DummyClass {
public:
d getKey(s<d> *var) {
return var->key = 10;
}
};
int main() {
DummyClass<TestStruct, double> myClas;
return 0;
}
It produces an error because of s<d>.
If I write:
Code:
template <class DataType>
struct TestStruct {
DataType key;
};
template <class s, class d>
class DummyClass {
public:
d getKey(s *var) {
return var->key = 10;
}
};
int main() {
DummyClass<TestStruct<double>, double> myClas;
return 0;
}
It works just fine. But that is not I want because I need to use "double" twice. Can anyone help?