[C++-sig] Automatic (implicit ?) type conversion for a data member of a struct.

pj pjdurai at hotmail.com
Fri May 16 18:24:49 CEST 2003


Generally how would I enable automatic conversion for a given C++ type ?

To be specific.

I know how to expose this class to Python and exposing a function returning
this struct.
Its pretty easy due to the power of boost-python.

class MyStruct
    std::string name;

MyStruct fuc1();

What I cant figure out is how would I do this if the 'name' is not a type
understood by boost-python.
say ..

class MyString;

class MyStruct
    MyString name;

MyStruct fuc1();

How would I expose 'MyStruct' to python so that the 'name' data member of
MyStruct is _automatically_  _exposed_ as
a python string ?

I have tried the basic documentation and couldnt find the information I

Appreciate your time.


More information about the Cplusplus-sig mailing list