小编gab*_*ben的帖子

Boost/Python:如何使用/转换提取的对象?

假设:

using namespace boost::python;
void myClass::test(numeric::array& arrayParam) {
    const tuple &shape = extract<tuple>(arrayParam.attr("shape"));
}
Run Code Online (Sandbox Code Playgroud)

我想将它转换为int并打印例如.我试过int x = shape[0];但它给了我一个"无法将'boost :: python :: api :: const_object_item'转换为初始化'消息中的'int'.

c++ python boost boost-python

4
推荐指数
1
解决办法
2497
查看次数

标签 统计

boost ×1

boost-python ×1

c++ ×1

python ×1