gpt4 book ai didi

c++ - C++ : How to deal with C++ templates? 的 C 包装器

转载 作者:搜寻专家 更新时间:2023-10-31 01:17:56 24 4
gpt4 key购买 nike

之前问的是为c++类写一个c wrapper(C Wrapper for C++),基本清楚了。

还有一个问题:如何处理 C++ 模板?假设这是我的类(class):

 template<typename T> class Temp
{
T get();
void set(T t);
}

有没有一种优雅的方式来编写 c 包装器?

最佳答案

您必须为每个专业编写一个单独的包装器。

关于c++ - C++ : How to deal with C++ templates? 的 C 包装器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7694515/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com