Boost logo

Boost Users :

Subject: [Boost-users] [python] raw pointer data members
From: Igor Mikushkin (igor.mikushkin_at_[hidden])
Date: 2009-08-17 12:53:49


Hello Boosters,

I'm trying to use Boost Python that way:

   template<class Key>
   struct Node
   {
      Node(Key key): key(key) {}
      Node* parent;
      Node* left;
      Node* right;
      Key key;
   };

.....

  BOOST_PYTHON_MODULE(tree)
   {
      class_<Node>("Node", init<int>())
         .def_readwrite("parent", &Node::parent)
         .def_readwrite("left", &Node::left)
         .def_readwrite("right", &Node::right)
         .def_readwrite("key", &Node::key);
   };

But then I can't use parent, left and right properties in Python code.
Is there a way to convert these raw pointers to common object
reference in Python?

Thanks in advance,
Igor


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net