(This is for C++11)
I'm trying to hide the template list of a templated class using a type alias, so I can make the code more readable. But it is not working and I'm not even sure if that is possible to do.
My code looks something like this:
template<
class A,
class B,
...
class Z>
class Class1
{
A objA;
B objB;
...
Z objZ;
};
// Define an alias for Class1 to hide all its template parameters
// in a way that is re-usable from other classes
typedef typename Class1<class A, class B, ..., class Z> Type_Class1
template<
class A,
class B,
...
class Z>
class Class2
{
// Create an obj of Class1,
Type_Class1 class1Obj;
...
}
...
template<
class A,
class B,
...
class Z>
class ClassN
{
// Create an obj of Class1
Type_Class1 class1Obj;
...
}
My intention is:
- Save the lines specifying all the template parameters everytime I create an obj of Class1
- Avoid specifying an alias type in every class where I want to create an obj of Class1
Any ideas?
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire