模板类的实现小技巧
摘要:
模板类和普通的类是有区别的,最主要的就是模板类的实例化问题。 所以呢最好是模板类的定义和模板类的实现放在一起。如果真的要不放在一起可以有以下两种解决办法:将 .cpp 文件include进 来第二: 在模板类的定义文件加上显式实例化。test.h templateclass Temp{};显示实例化: template Temp; template Temp; template Temp; 阅读全文
posted @ 2006-03-23 20:23 host of nature 阅读(302) 评论(0) 推荐(0) 编辑