为何只能在头文件中实现模板? - Why can templates only be implemented in the header file?

问题:

Quote from The C++ standard library: a tutorial and handbook : 引用来自C ++标准库:教程和手册 函数

The only portable way of using templates at the moment is to implement them in header files by using inline functions. 目前使用模板的惟一可移植方法是经过使用内联函数在头文件中实现它们。 this

Why is this? 为何是这样? google

(Clarification: header files are not the only portable solution. But they are the most convenient portable solution.) (澄清:头文件不是惟一的可移植解决方案。可是它们是最方便的可移植解决方案。) spa


解决方案:

参考一: https://stackoom.com/question/24mD/为何只能在头文件中实现模板
参考二: https://oldbug.net/q/24mD/Why-can-templates-only-be-implemented-in-the-header-file
相关文章
相关标签/搜索