I'm trying to use a template template parameter as a default value for other template parameters but when I try to use the identifier (template template parameter name/id ) it cannot be found. I'm using VS 2013. The idea is that I have a "factory" class based on a specific type of template instantiation I need to return another object with the same number of parameters (4) BUT with the same specialization.
template<class T1, class T2,class T3, class T4>
class CommandBus
{...}
template <
template<class T1, class T2, class T3, class T4> class ListenerType,
//The Line bellow fails to compile, T1 is not visible
//E0020 identifier "T1" is undefine
class CommandBusType = CommandBus<T1, T2, T3, T4> >
class CommandBusFactory {
static auto Get() {
return CommandBusType{};
}
};
int main{
//Say I would Have some Object :
Listener<int, int ,int int> Listener;
//Withought the Factory I would have to manually generate a ComamndBus of the same specialization (int , int , int, int):
CommandBus<int,int,int,int> cmdBus;
//But I could use a factory, things should look like:
Listener<int, int ,int int> listener;
auto cmdBus = CommandBusFactory<Listener<int,int,int,int>>::Get();
}
I was expecting this to work but the compiler complains that for example identifier T1,T2 etc not found for the default value (CommandBus)for template parameter CommandBusType.
Is is possible to use template template arguments as default value for other template arguments?