I have a bunch of template parameters that I want to hide from my users. How can I do this?
- by Alex
I have a superclass which is defined in terms of a few internal types it uses. Subclassing is performed as so:
template <class InternalType1, class InternalType2>
class Super
{
...
}
class Sub : Super <interalTypeClass1, interalTypeClass2>
{
...
}
But when I want to write a function that takes a pointer to the superclass, this happens :
template <class InternalType1, class InternalType2>
void function(Super<InternalType1, InternalType2>* in) { ... }
The user really shouldn't know anything about the inside classes, and should really just concern himself with the use of the function. Some of these template lists become very very large, and expecting the user to pass them every time is wasteful, in my opinion.
Any suggestions?
EDIT: The function needs to know the internal types in use, so unless there is a way to access template types at compile time, I think there is no solution?
Potential solution: Have each class do the following:
#define SubTemplateArgs <SubTypeName, SubInternalType1, SubInternalType2>
?