1) class_< std::list<Thingy> >("ListOfThingys") .def(vector_indexing_suite< std::list<Thingy> >() ) 2) This is really too complex to show quickly. Just read the c++ header and do the same thing to list that you did to myclass.
3) bp::list getter (const MyClass& self) { bp::list L //move the values in self.ilist to L return L } void setter (const MyClass& self, bp::list L) { //move the values in L to self.ilist } class_<Myclass>("Myclass") .def_readwrite("i", &Myclass::i) .def_readwrite("f", &Myclass::f) .add_property ("ilist", &getter, &setter) ; That's the gist of it. I am not sure if 1 works and 2 will be difficult, so I recommend 3 -----Original Message----- From: cplusplus-sig-bounces+matthew.scouten=tradingtechnologies....@python.org [mailto:cplusplus-sig-bounces+matthew.scouten=tradingtechnologies....@python.org] On Behalf Of Anders Wallin Sent: Thursday, February 04, 2010 2:12 PM To: Development of Python/C++ integration Subject: Re: [C++-sig] accessing nontrivial types are there examples of how to do this somewhere? for something like list<int>, MyClass and list<MyClass> thanks, AW > 1) the vector_indexing_suite might work for a std::list. Give it > a try. > 2) Manually expose the function the you care about. > 3) have a couple of get/set functions as a property that copies > your std::list to and from a bp::list. _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig