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

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -