Re: [C++-sig] Quick question about wrapping methods that have multiple versions

2009-09-08 Thread Jean-Sébastien Guay
Hi Stefan, This is not a wrapper function, but an alias. You create a new variable 'B_getA1', and make this point to B::getA (the non-const version). This works, since by means of the variable type you disambiguate, so using that in the call to def() works unambiguously. Sorry, thanks for cor

Re: [C++-sig] Quick question about wrapping methods that have multiple versions

2009-09-08 Thread Stefan Seefeld
On 09/08/2009 11:30 PM, Jean-Sébastien Guay wrote: If I just add .def("getA", &B::getA, some_return_policy) to my class_ wrapper, on compile it will complain that it doesn't know which version of B::getA() I want. Up until now the way I wrapped this was to make a trivial wrapper function: A

[C++-sig] Quick question about wrapping methods that have multiple versions

2009-09-08 Thread Jean-Sébastien Guay
Hi all, This may be an FAQ, but if so I haven't seen it in the FAQs (on the wiki and in the docs). Say I have this: class A {}; class B { public: A* getA(); const A* getA() const; }; If I just add .def("getA", &B::getA, some_return_policy) to my class_ wrapper, on compile it will

Re: [C++-sig] boost.python - C++ class overridden in python causes slicing

2009-09-08 Thread Jean-Sébastien Guay
Hi Renato, You can use "boost::python::ptr(your_cpp_cpointer)" this avoid create unecessary copies. Thanks for the tip, boost::ref() for references and boost::python::ptr() for pointers, makes sense. J-S -- __ Jean-Sebastien Guayjean-s

Re: [C++-sig] boost.python - C++ class overridden in python causes slicing

2009-09-08 Thread Renato Araujo
Hi Jean, You can use "boost::python::ptr(your_cpp_cpointer)" this avoid create unecessary copies. BR Renato Araujo Oliveira Filho On Tue, Sep 8, 2009 at 11:41 PM, Jean-Sébastien Guay wrote: > Hi all, > > I found an post from earlier this year to this list where David Abrahams > said: > > ---

Re: [C++-sig] boost.python - C++ class overridden in python causes slicing

2009-09-08 Thread Jean-Sébastien Guay
Hi all, I found an post from earlier this year to this list where David Abrahams said: If you want to pass an object by reference to a python function, you have to wrap it in boost::ref(). Otherwise, it will try to copy the object and the resulting copy will have to be de

[C++-sig] Subset of default python library

2009-09-08 Thread Mark Chandler
Is there a small subset of the default python library that i can use for our embedded instance. Since this is part of a larger app that doesnt expect to have python installed thus we are including it with the program data. How ever there is alot of stuff in there that we are not going to us

Re: [C++-sig] boost.python - C++ class overridden in python causes slicing

2009-09-08 Thread troy d. straszheim
[reply taken offlist] oops, apparently not, apologies. -t ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] Boost.Python & OpenSceneGraph

2009-09-08 Thread Jean-Sébastien Guay
Hi Randolph, I am working on an OpenSceneGraph/Python project and have had to abandon the OSG/SWIG tools--they are not developed enough for my purpose. So I am planning on writing special purpose code to that end. Does anyone have suggestions for someone starting out on this path? Heh, if

Re: [C++-sig] boost.python - C++ class overridden in python causes slicing

2009-09-08 Thread troy d. straszheim
Jean-Sébastien Guay wrote: Hi again Troy, I was thinking of setting up a googlecode project for this work, because there is at least one other person who might be interested in working with me on it (Paul Melis). I'll see if I can do that soon. It's done now, here: http://code.google.com/p/

Re: [C++-sig] boost.python - C++ class overridden in python causes slicing

2009-09-08 Thread Jean-Sébastien Guay
Hi Troy, Competitive isn't an issue, as swig and boost.python bindings aren't really compatible (or is that 'sip' bindings that aren't compatible?). Personally I prefer a manual approach over automatically generated bindings; apparently for the same reasons that some compiler writers insist o

Re: [C++-sig] boost.python - C++ class overridden in python causes slicing

2009-09-08 Thread Jean-Sébastien Guay
Hi again Troy, I was thinking of setting up a googlecode project for this work, because there is at least one other person who might be interested in working with me on it (Paul Melis). I'll see if I can do that soon. It's done now, here: http://code.google.com/p/osgboostpython/ Note that I

Re: [C++-sig] boost.python - C++ class overridden in python causes slicing

2009-09-08 Thread troy d. straszheim
Jean-Sébastien Guay wrote: Hello Troy, I've been doing a bunch of work with osg recently. I like it and badly miss some boost.python bindings. I'd be very interested to have a look at the code here, maybe pitch in a bit. Is there a git archive I can clone, and a failing test I can run?

Re: [C++-sig] Boost.Python & OpenSceneGraph

2009-09-08 Thread Roman Yakovenko
On Tue, Sep 8, 2009 at 9:35 PM, R Fritz wrote: > I am working on an OpenSceneGraph/Python project and have had to abandon the > OSG/SWIG tools--they are not developed enough for my purpose.  So I am > planning on writing special purpose code to that end.  Does anyone have > suggestions for someone

[C++-sig] Boost.Python & OpenSceneGraph

2009-09-08 Thread R Fritz
I am working on an OpenSceneGraph/Python project and have had to abandon the OSG/SWIG tools--they are not developed enough for my purpose. So I am planning on writing special purpose code to that end. Does anyone have suggestions for someone starting out on this path? Randolph Fritz d

Re: [C++-sig] boost.python - C++ class overridden in python causes slicing

2009-09-08 Thread Jean-Sébastien Guay
Hello Troy, I've been doing a bunch of work with osg recently. I like it and badly miss some boost.python bindings. I'd be very interested to have a look at the code here, maybe pitch in a bit. Is there a git archive I can clone, and a failing test I can run? I was thinking of setting up

Re: [C++-sig] Trouble optimizing Boost.python integration

2009-09-08 Thread Gustavo Carneiro
2009/9/8 Stefan Seefeld > On 09/08/2009 10:51 AM, Gustavo Carneiro wrote: > >> 2009/8/25 Dan Sanduleac > sanduleac@gmail.com>> >> >>Hi, >> >>I'm trying to compare different python-C wrapping techniques to >>see which would be faster and also more suited to game development. >> >>

Re: [C++-sig] Trouble optimizing Boost.python integration

2009-09-08 Thread Stefan Seefeld
On 09/08/2009 10:51 AM, Gustavo Carneiro wrote: 2009/8/25 Dan Sanduleac > Hi, I'm trying to compare different python-C wrapping techniques to see which would be faster and also more suited to game development. If your project does not use multiple i

Re: [C++-sig] Trouble optimizing Boost.python integration

2009-09-08 Thread Gustavo Carneiro
2009/8/25 Dan Sanduleac > Hi, > > I'm trying to compare different python-C wrapping techniques to see which > would be faster and also more suited to game development. > If your project does not use multiple inheritance, I may suggest you also try with PyBindGen: http://code.google.com/p/pybindg

Re: [C++-sig] Trouble optimizing Boost.python integration

2009-09-08 Thread Hans Meine
On Tuesday 25 August 2009 23:48:02 Dan Sanduleac wrote: > The thing is, it proves to be kind of slow compared to Cython/Pyrex code > that does the same. I think it should run faster than Cython code. I think this is because your vectors are too small. I think for such small objects, the implemen

Re: [C++-sig] boost.python - C++ class overridden in python causes slicing

2009-09-08 Thread troy d. straszheim
Jean-Sébastien Guay wrote: Hi all, Thanks to previous help (a while ago) I was able to make considerable progress wrapping a pretty complex library (OpenSceneGraph) with boost.python. Hey Jean-Sebatien, I've been doing a bunch of work with osg recently. I like it and badly miss some boo