[C++-sig] Boost Python loss of values
Jim Bosch
talljimbo at gmail.com
Thu Aug 25 22:18:04 CEST 2011
On 08/25/2011 04:17 AM, Jay Riley wrote:
>
> And the python exposing is done as follows:
>
> class_<Attack, AttackWrapper, boost::shared_ptr<Attack>, bases<Action>
> >("Attack")
> .def("CalculateDamage", &AttackWrapper::CalculateDamageDefault);
>
This bit looks a little suspect, and I'm surprised that it compiles -
class_ should only take 4 arguments if one of them is boost::noncopyable.
I think you mean:
class_< Attack, boost::shared_ptr<AttackWrapper>, bases<Action> >
(...)
See
http://www.boost.org/doc/libs/1_47_0/libs/python/doc/v2/class.html
for details of the arguments to class_.
I don't have a good idea as to why this would cause the problem you're
seeing (maybe you're slicing your AttackWrapper instances into Attack
instances?) but I'd recommend fixing it first.
Good Luck!
Jim Bosch
More information about the Cplusplus-sig
mailing list