[C++-sig] how to wrap a typedef std::list in boostPython?

brett hartshorn bhartsho at yahoo.com
Fri Sep 17 06:55:43 CEST 2004


Hi,

I am having some problems wrapping a typedef std::list in boostpython.  Here is my code:

typedef std::list< osg::ref_ptr<osgGA::GUIEventHandler> > EventHandlerList;

and the wrapper:

    class_<osgProducer::Viewer::EventHandlerList>("EventHandlerList")
	.def("push_back", &osgProducer::Viewer::EventHandlerList::push_back)
	.def("push_front", &osgProducer::Viewer::EventHandlerList::push_front)
	.def("__iter__", iterator<osgProducer::Viewer::EventHandlerList>())
	;

the error that python reports when trying to use the push_front function.

Traceback (most recent call last):
  File "./osgkeyboard.py", line 385, in ?
    main(sys.argv)
  File "./osgkeyboard.py", line 358, in main
    viewer.getEventHandlerList().push_front(osgGA.GUIEventHandler())
Boost.Python.ArgumentError: Python argument types in
    EventHandlerList.push_front(EventHandlerList, GUIEventHandler)
did not match C++ signature:
    push_front(std::list<osg::ref_ptr<osgGA::GUIEventHandler>,
std::allocator<osg::ref_ptr<osgGA::GUIEventHandler> > > {lvalue},
osg::ref_ptr<osgGA::GUIEventHandler>)


-brett


		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 



More information about the Cplusplus-sig mailing list