Clone wiki

pyd / StructWrap

Struct Wrapping

Wrapping D's structs is nearly identical to wrapping classes.

See also


As with calls to wrap_class, calls to wrap_struct must occur after calling module_init.

It is important to note that wrapping a struct S makes both S itself and S* available as convertible types.

Automatic operator overloading

Support for operator overloading in structs is identical to that available for classes.


D does not support struct inheritance. Therefore, Pyd does not provide any support for struct inheritance. However, the Python type wrapping the D struct can be subclassed from within Python. Users should not expect polymorphic behavior if they attempt to pass instances of any subclasses back to D.