boost python怎么封装返回指针的函数
原作者:http://www.verydemo.com/demo_c122_i8276.html
boost python如何封装返回指针的函数
double** Create_Double_Memory(int ySize, int xSize)
{
if (ySize <= 0 || xSize <= 0)
return NULL;
double** p = new double*[ySize];
for (int i = 0; i < ySize; i++)
p[i] = new double[xSize];
return p;
}
BOOST_PYTHON_MODULE(L1_L0_Drive)
{
def("Create_Short_Memory", Create_Short_Memory, return_value_policy<manage_new_object>());
}
编译时报错
error C2027: 使用了未定义类型“boost::STATIC_ASSERTION_FAILURE<x>”
1>
请问如何封装返回指针的函数啊?
------解决方案--------------------------------------------------------
manage_new_object返回类的动态对象,要返回简单的指针,把manage_new_object改为return_xxx_pointer,具体名字记不得了,反正有这个模板,查阅boost文档吧
double** Create_Double_Memory(int ySize, int xSize)
{
if (ySize <= 0 || xSize <= 0)
return NULL;
double** p = new double*[ySize];
for (int i = 0; i < ySize; i++)
p[i] = new double[xSize];
return p;
}
BOOST_PYTHON_MODULE(L1_L0_Drive)
{
def("Create_Short_Memory", Create_Short_Memory, return_value_policy<manage_new_object>());
}
编译时报错
error C2027: 使用了未定义类型“boost::STATIC_ASSERTION_FAILURE<x>”
1>
请问如何封装返回指针的函数啊?
------解决方案--------------------------------------------------------
manage_new_object返回类的动态对象,要返回简单的指针,把manage_new_object改为return_xxx_pointer,具体名字记不得了,反正有这个模板,查阅boost文档吧
相关推荐
hanjinixng00 2020-11-12
bearhoopIT之道 2020-11-11
拉斯厄尔高福 2020-10-19
dabian 2020-09-07
Web前端成长之路 2020-07-07
csdnyasin 2020-06-28
徐建岗网络管理 2020-06-26
penkgao 2020-06-25
fengjing81 2020-06-24
penkgao 2020-06-13
qscool 2020-06-12
chaocc0xs 2020-06-12
风吹夏天 2020-06-08
fengjing81 2020-06-06
jvm 2020-06-06
AaronPlay 2020-06-02