[英]How to wrap final tempate class from C++ using swig?
I am trying to wrap a template which is marked as final from C++ to C# without success. 我正在尝试将标记为final的模板从C ++包装为C#,但没有成功。 Swig will say "Template 'Test' undefined"
Swig会说“未定义模板'Test'”
It works if I remove the final keyword but the header isn't under my control. 如果我删除了final关键字但标头不在我的控制之下,则该方法有效。
%module SwigTest
template <typename T>
class Test final
{
public:
T a;
};
%template(TestBool) Test <bool>;
Does the final effect the name in any way? 最终效果是否会以任何方式影响名称? I tried
我试过了
%template(TestBool) Test final <bool>;
and similar combinations but no success. 和类似的组合,但没有成功。
Looks like SWIG doesn't understand final
yet. 看起来SWIG
final
还不了解。 You can trivially work around this with the pre-processor in SWIG though: 不过,您可以使用SWIG中的预处理器来解决此问题:
%module SwigTest
#define final
template <typename T>
class Test final
{
public:
T a;
};
%template(TestBool) Test <bool>;
This will work with no negative impact. 这将不会产生负面影响。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.