我正在尝试使用需要指向类的指针的函数。
我收到以下错误
<class 'Boost.Python.ArgumentError'>: Python argument types in
G4TessellatedSolid.AddFacet(G4TessellatedSolid, G4TriangularFacet)
did not match C++ signature:
AddFacet(G4TessellatedSolid {lvalue}, G4VFacet*)
G4TesselledSolid具有功能 G4bool AddFacet(G4VFacet * aFacet)
G4TriansularFacet类定义有 G4TriangularFacet类:公共G4VFacet
我的Boost类定义如下
class_<G4TessellatedSolid, G4TessellatedSolid*, boost::noncopyable>
("G4TessellatedSolid", "solid class")
// ---
.def("AddFacet", &G4TessellatedSolid::AddFacet)
// operators
.def(self == self)
;
我的Python看起来像 棋盘格= G4TessellatedSolid() tessellate.AddFacet(face)
答案 0 :(得分:1)
通过为定义添加碱基可以解决参考
class_<G4VFacet, G4VFacet*, boost::noncopyable>
("G4VFacet", "solid class", no_init)
// ---
.def("SetVertex", &G4TriangularFacet::SetVertex)
// operators
.def(self == self)
;
class_<G4TriangularFacet, bases<G4VFacet> , boost::noncopyable>
("G4TriangularFacet", "solid class")
// ---
.def("SetVertex", &G4TriangularFacet::SetVertex)
// operators
.def(self == self)
;