I am trying to instantiate a template externaly however I would like o use a typedef in the instantiation clause. I think the example says more than thousand words:
typedef myTemplate_base<commonValue> myTemplate; //in 99% of the cases I use this so I want a shorthand
extern template class myTemplate; //wont work/compiler error class infront of typedef
I get the same error if I try to actually instantiate the template like this:
template class myTemplate;
I know I can write (extern) template class myTemplate_base<commonValue>
instead, however I think this is uglier, since I need to adjust my common Value in 3 places instead of one.
So how do I have to put this, to use the typedef in the extern declaration/instantiation?
I am ussing gcc 4.6.1 on Ubunutu
typedef-name cannot be used in explicit instantiation.
From 14.7.2/3
If the explicit instantiation is for a class or member class, the elaborated-type-specifier in the declaration shall include a simple-template-id. If the explicit instantiation is for a function or member function, the unqualifiedid in the declaration shall be either a template-id or, where all template arguments can be deduced, a template-name or operator-function-id. ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With