【发布时间】:2014-06-25 17:13:48
【问题描述】:
我正在尝试使用 Boost Python 导出一个如下所示的类:
struct bool_array
{
bool_array(bool constructor_bool[7])
{
for(unsigned int i=0; i < 7; i++)
bools[i] = constructor_bool[i];
}
bool bools[7];
};
我也想公开构造函数,使用以下 Boost 代码:
class_<bool_array>("bool_array", init<bool*>())
.def_readwrite("bools", &bool_array::bools)
;
问题是我得到这个编译器错误:
error C2440: '=' : cannot convert from 'const bool [7]' to 'bool [7]'
我也试过了
init<bool[7]>
和
init<bool[]>
无济于事。
我确定我遗漏了一些明显的东西,但我一直无法弄清楚我需要做什么来公开这个类。
谢谢
【问题讨论】:
标签: python c++ class boost constructor