I have to implement a data structure in multiple different ways, each of which should be compatible with using multiple data types.
I then have to make a class that can test all of these implementations using different data types.
Example:
Testobject obj = Testobject<DatastructType1<int>>();
Testobject obj2 = Testobject<DatastructType2<float>>();
I have tried multiple ways to use the correct syntax for the Testobject class.
template <typename T, typename U>
class Testobject {
public:
Testobject();
private:
T<U> data;
};
It looks like this now, but instead of this first line I have also tried the following:
template <typename T <typename U>>
template <typename T, template <typename> class U>>
template <template <typename T> class U>
So basically I'm wondering what the right syntax is.
EDIT: my lecturer just simplified the assignment, so this is no longer necessary. However, if anyone has a solution, I'm still curious.