The saparation between the declaration and the defination of template class is illegal. That is because the template class is not a real class. The compiler take resposibility to generate the specific class when the user assign the argument of the parameter. So there is no interface or implementation for template class. All the code is declaration like the MACRO. The compiler can not link the implementation and the declaration.
So, just keep in mind, put all the code of template class in a single file; do not separate them.
本文解释了模板类为何不能分离声明与定义的原因。由于模板类并非实际类,编译器会在用户指定参数时生成具体类。因此,模板类没有单独的接口与实现部分,所有代码均为声明形式,类似宏定义。
1246

被折叠的 条评论
为什么被折叠?



