Skip to content Skip to sidebar Skip to footer

Pass By Reference In Boost::python

Consider something like: struct Parameter { int a; Parameter(){a = 0;} void setA(int newA){a = newA;} }; struct MyClass { void changeParameter(Parameter &p){ p.

Solution 1:

Python doesn't have references, so when you pass reference to python boost::python calls copy-ctor of your object.

In this case you have two choices: Replace references with pointers (or smart-pointers) or pass into python your own 'smart-reference' object/wrapper.

Post a Comment for "Pass By Reference In Boost::python"