如何使用博斯。Python?在
class C {
public:
static void F(int) {}
static void F(double) {}
};
我试过这样的方法:
^{pr2}$但是,它在Python中引发了一个异常(SystemError: initialization of libdistributions raised unreported exception
)。如果我从bp::class_
中删除一个重载,那么一切都正常。我知道Boost.Python可以自动处理重载的构造函数,所以我想知道是否有类似的静态方法。在
bp::class_<C>("C")
.def("F", (void (C::*)(int))&C::F) // Note missing staticmethod call!
.def("F", (void (C::*)(double))&C::F).staticmethod("F")
;
我想你可以在这里找到解决问题的方法:
http://www.boost.org/doc/libs/1_48_0/libs/python/doc/tutorial/doc/html/python/functions.html#python.overloading
相关问题 更多 >
编程相关推荐