显式模板实例化是否在 cpp 或头文件中? [英] Does explicit template instantiation go in cpp or header file?

查看:27
本文介绍了显式模板实例化是否在 cpp 或头文件中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

显式模板实例化是否在 cpp 或头文件中?

Does explicit template instantiation go in cpp or header file?

推荐答案

我一直在 cpp 文件中完成.在标头中,至少(在通常情况下)当标头包含在多个 cpp 文件中时,它会违反一个定义规则.

I've always done it in a cpp file. In a header, it would violate the one definition rule, at least (in the usual case) when the header was included in more than one cpp file.

这篇关于显式模板实例化是否在 cpp 或头文件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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