[C++-sig] Wrapping C++ class with unnamed union

Kevin Vance kvance at wam.umd.edu
Wed Dec 15 23:38:40 CET 2004


Hi,

I am new to boost.python, so there may be a very simple answer to this.
I would like to access the OGRE graphics library from python.  But it has
several classes with data like this:

union {
  struct {
    Real r,g,b,a;
  };
  Real val[4];
};

And I cannot access e.g. 'r' with a statement like:

.def_readwrite("r", &Ogre::ColourValue::r)

I'm assuming this is because there is an unnamed union and unnamed struct
in between the class and the 'r'.  I could write a new C++ class to wrap
this one, and then use boost to wrap *that*.  But if there is a simpler
way, I would rather use it.

Thanks for your advice,
kvance



More information about the Cplusplus-sig mailing list