I've been trying to figure out how to expose a property in my class that is a
boost::tuple. The tuple is defined as follows:
typedef boost::shared_ptr<Action> action_ptr;
typedef boost::tuple<BattleCharacter*, action_ptr > ActionTargetTuple;
It's contained with a class defined as follows:
class Action : public Cloneable<Action>
{
public:
//Irrelevant Code Omitted
std::vector<ActionTargetTuple> Targets;
}
I've seen numerous articles while I was searching about how to convert a
boost::tuple into a python tuple, but that's not what I'm looking to do. I want
to be able to access the tuple as it exists on the Action class. (I know how to
do the vector part). The action class is exposed as follows:
class_<Action>("Action")
.def("Targets", &Action::Targets)
;
I figured I might be able to expose the tuple by some variation on the below:
class_<ActionTargetTuple>("ActionTargetTuple")
.def("get", &ActionTargetTuple::get<int>,
return_value_policy<reference_existing_object>())
;
then use get from python, but if it is doable in this way, I'm not sure what
the set up needs to be. Does anyone know how to do this/could suggest an
alternative?
Thanks _______________________________________________
Cplusplus-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cplusplus-sig