c++ - why Specialized template class need forward declaration? -


such code:

template<typename,int> class uoo;  //without result in complie error,why?  template<typename t> class uoo<t,1> { };  int main(){     return 0; } 

why specialized template class need forward declaration?

the following code specialisation of template.

template<typename t> class uoo<t,1> { }; 

but haven't said unspecialised form is, , language requires that. need add prototype:

template<typename,int> class uoo; 

you don't need declare unspecialised form since instance of never required. prototype sufficient.


Comments

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -