完全专业的模板和dllexport [英] Fully specialised templates and dllexport
问题描述
Microsoft说:模板不能与用__declspec(dllimport)或__declspec(dllexport)声明的函数一起使用。 (链接)。
是什么意思?我可以导出具有完全专门的模板类引用作为参数的函数吗?
那不是 dllexport
/ dllimport
特定的问题,这是模板的普遍问题-当前只有一个编译器实现 export
模板,请参见 Comeaus模板常见问题解答以了解详细信息。
完全专业的模板是独特而具体的类型,基本上可以与 __ declspec
扩展一起使用,但是有<除了您链接的条目之外,还a href = http://msdn.microsoft.com/zh-cn/library/twa2aw10%28VS.80%29.aspx rel = nofollow noreferrer>限制。 p>
我个人主要是在这里避免在界面中使用模板,而仅在内部使用它们-我看不出为解决这些限制而投入的时间有何大好处。
Microsoft says: "Templates cannot be used with functions declared with __declspec (dllimport) or __declspec (dllexport)." (link).
What does this mean? Can I export a function which has a fully specialized template class reference as an argument?
That isn't a dllexport
/dllimport
-specific problem, its a general issue with templates - only one compiler currently implements the means to export
templates, see Comeaus template FAQ for details.
Fully specialized templates however are distinct and concrete types and basically usable with the __declspec
extension, but there are limitations besides the entry you linked.
Personally i'd mainly avoid templates in the interface here and only use them internally - i don't see the what big benefits the time invested in working around the limitations give you.
这篇关于完全专业的模板和dllexport的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!