[C++-sig] boost python: How to convert a class X object to class Y object automatically

Liwei Peng liwei_peng at yahoo.com
Mon Feb 14 00:14:40 CET 2005


Hi,

Can someone give me some suggestion on how I can
convert
a class X object to a class Y object automatically 
through boost python?

class Y {
...
};

class X {
public:
  Y get_y();
   ...
};

While in C++, I can do this:
  X x;
  Y y = x.get_y();

In python, I'd like to convert X object automatically,
transparently to Y object without having to call
"get_y()".

Any comments are welcome,

Thanks,

Liwei





		
__________________________________ 
Do you Yahoo!? 
Meet the all-new My Yahoo! - Try it today! 
http://my.yahoo.com 
 




More information about the Cplusplus-sig mailing list