[Python] Wrapping Visitor Pattern and Object Slicing
Hey All, I'm trying to wrap a third party lib that uses the visitor pattern and their own smart pointers ('ref_ptr' below), which manages objects that inherit from 'Referenced'. I've put together a simple example that illustrates the problem. Code for python bindings : http://codepad.org/wq47m5CI Simple test script : http://codepad.org/Jfme3U6U Output for two cases : http://codepad.org/gbFBxy04 Case 1) 'apply' override is commented out in the python class Case 2) 'apply' override exists The problem that I'm having is that the 'apply' method ( lines 83 - 86 ) slices everything to base unless I use boost::ref(). However this only works for wrapped classes and in this lib several classes use derived visitors that are not part of the public API ( which I modeled as HelperVisitor in the above example ). Is there anyway to prevent object slicing for both wrapped and unwrapped objects in this scenario? I'm building against boost 1.47 and if anyone's interested in digging deeper the 3rd party lib is Open Scene Graph 3.0.1. Thanks, Alex.
participants (1)
-
Alex Olivas