Re: [C++-sig] accessing nontrivial types

2010-02-04 Thread Matthew Scouten (TT)
1) class_< std::list >("ListOfThingys") .def(vector_indexing_suite< std::list >() ) 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 //

[C++-sig] Getting a b::p::object for a PyObject and vice-versa.

2010-02-04 Thread Murray Cumming
Can someone confirm that this is correct: 1. To get a boost::python::object that wraps an existing PyObject* (when you get a PyObject from a C function not wrapped in boost::python), can someone confirm that this is correct: Either: a) PyObject* c_object = get_the_c_object(); //returns a referen

Re: [C++-sig] accessing nontrivial types

2010-02-04 Thread Anders Wallin
are there examples of how to do this somewhere? for something like list, MyClass and list 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

Re: [C++-sig] accessing nontrivial types

2010-02-04 Thread Matthew Scouten (TT)
The stl containers are not handled by default. You will have to manually expose it. You have a few options here: 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

[C++-sig] accessing nontrivial types

2010-02-04 Thread Anders Wallin
Hello group, simple types (int, float, etc.) seem to transfer without problem to C++ and back to Python, but whenever I try returning something nontrivial from C++ I get something like this: >>> a = myclass.Myclass() >>> print a.i 42 >>> print a.f 3.14159 >>> print a.ilist Traceback (most recent ca