//The node class should be held by std::auto_ptr
class_<Node, std::auto_ptr<Node> >("Node")
为add_子方法创建瘦包装函数:
void node_add_child(Node& n, std::auto_ptr<Node> child) {
n.add_child(child.get());
child.release();
}
完成代码以公开节点类:
//The node class should be held by std::auto_ptr
class_<Node, std::auto_ptr<Node> >("Node")
//expose the thin wrapper function as node.add_child()
.def("addChild", &node_add_child)
;