有没有办法处理模板函数的未定义的引用错误,而不实现它们在标题? [英] Is there a way to cope with undefined reference error for template functions without implementing them in header?

查看:123
本文介绍了有没有办法处理模板函数的未定义的引用错误,而不实现它们在标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望问题清楚。有没有另一种方法不能得到未定义的引用错误,而不实现头文件中的模板函数?提前感谢。

I hope the problem is clear. Is there an alternative way not to get undefined reference error without implementing template functions in header files? Thanks in advance.

推荐答案

如果您事先知道所需的所有实例化,您可以手动实例化它们。

If you know in advance which all instantiations you will need, you can instantiate them manually.

这篇关于有没有办法处理模板函数的未定义的引用错误,而不实现它们在标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆