[C++-sig] Re: iterate through boot::python::list

David Abrahams dave at boost-consulting.com
Wed Mar 12 18:16:34 CET 2003


harold fellermann <harold at imb-jena.de> writes:

> Thank you, this works fine. But I still cannot get along with my
> stuff...
> My plan is to insert references to C++ objects within a
> boost::python::list.
> The code looks like the following:
>
> class X {
> 	// ...
> };
>
> class Y {
> public:
> 	void insert(X &);
> 	boost::python::list xlist;
> };
>
> void Y::insert(X &x) {
> 	// do some other things
> 	xlist.insert(0,x)
> }
>
> int main() {
> 	X x; Y y;
> 	y.insert(x);
> }
>
> Unfortunately this little snippet crashes:

You're not being (completely) honest with us ;-) There's a class
called "Node" somewhere which you haven't told us about.

Aside from not initializing the interpreter, it looks like you have
not exposed class Node to python.  That's what's causing the exception
throw you see in the stack backtrace.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com





More information about the Cplusplus-sig mailing list