The best way is do what the STL does, that is put all the template code(the declaration and the implementation) in a header file or a file without a postfix. It is indeed quite different from the non-template classes. The reason is the compiler needs
all the code(including the definition of the member functions) to instantiate a template class. And include the file which contains the template code in the files where you use the template class. There's no way to include only the header file (without including the implementation lines).
使用模板代码的时候出现Link2019 ERROR
最新推荐文章于 2022-12-19 14:03:41 发布