[C++-sig] how to wrap a typedef std::list in boostPython?
Ralf W. Grosse-Kunstleve
rwgk at yahoo.com
Fri Sep 17 13:09:58 CEST 2004
--- brett hartshorn <bhartsho at yahoo.com> wrote:
> 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>)
The element type of your std::list<> template instantiation is:
osg::ref_ptr<osgGA::GUIEventHandler>
What is osg::ref_ptr<>? How did you wrap osgGA::GUIEventHandler? Somehow you
have to tell Boost.Python how to extract a osgGA::GUIEventHandler from a
osg::ref_ptr<osgGA::GUIEventHandler>.
Ralf
__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail
More information about the Cplusplus-sig
mailing list