Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ol> <li><p>Documentation on virtual functions you reference is related to wrapping virtual functions which can be further overridden in python -- i.e. in python classes deriving from the c++ class. The logic is such that c++ only handles virtual resolution in c++; if it lands on the wrapper class (from which your python classes derive), <code>this-&gt;get_override(..)</code> will further look if the python class overrides that particular function.</p> <p>It is not clear whether this is really what you need (i.e. deriving python classes from c++ classes). If you only want to expose regular c++ virtual functions, virtual resolution is handled automatically.</p></li> <li><p>Further, I don't understand what kind of data your functions take. Can you give a more specific example? If you have data you want to iterate over in the c++ class already, define special python functions <code>__iter__</code>, which will return an proxy iterator object (you define the iterator class in c++ and wrap it in python as well); this proxy iterator must hold internally iteration state and define <code>__iter__</code> (returning self), <code>next</code> (returning next container item), and raise StopIteraton at the end. Such is the python iteration protocol and all usual constructs (<code>for</code> etc) will work automagically. (see e.g. <a href="http://bazaar.launchpad.net/~eudoxos/+junk/tr2/view/head:/pkg/dem/ContactContainer.hpp#L111" rel="nofollow">here</a>, iterator class <a href="http://bazaar.launchpad.net/~eudoxos/+junk/tr2/view/head:/pkg/dem/ContactContainer.hpp#L82" rel="nofollow">here</a> for an example)</p></li> <li><p>(Remark) don't pass <code>vector&lt;int&gt;</code> as argument, avoid copying with <code>const vector&lt;int&gt;&amp;</code>. Converters for <code>vector&lt;int&gt;</code> from python (if you define them) will work just fine.</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload