C Wrapper for C++:如何处理 C++ 模板? [英] C Wrapper for C++: How to deal with C++ templates?
本文介绍了C Wrapper for C++:如何处理 C++ 模板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
之前问的是为 C++ 类编写 ac 包装器(C 包装器用于 C++),这基本上是清楚的.
Earlier was asking about writing a c wrapper for c++ classes ( C Wrapper for C++ ), which is basically clear.
还有一个问题:我如何处理 C++ 模板?假设这是我的课程:
There's one more question though: how do I deal with c++ templates? Let's say this is my class:
template<typename T> class Temp
{
T get();
void set(T t);
}
有没有一种优雅的方式来编写一个 c 包装器?
Is there an elegant way to write a c wrapper?
推荐答案
您必须为每个专业化编写单独的包装器.
You have to write a separate wrapper for each specialization.
这篇关于C Wrapper for C++:如何处理 C++ 模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文