[C++-sig] Re: Wrapping multiple class_<T> objects

Mike Rovner mike at bindkey.com
Wed Nov 20 20:18:35 CET 2002

"Peter Bienstman" <Peter.Bienstman at rug.ac.be> wrote in message
news:200211201431.57704.Peter.Bienstman at rug.ac.be...
> There are lots of ways to write this so you don't instantiate the same
> class_<> twice. One is:
>   object slabwallmixed
>          = class_<SlabWallMixed, bases<SlabWall> >
>             ("SlabWallMixed", init<const Complex&, const Complex&>());
>   object slab_E_wall = slabwallmixed(1.0,1.0);
>   object slab_H_wall = slabwallmixed(1.0,-1.0);

Cool! But are these objects only for C++ internal use, or can I export them

Sure. Add the following:
scope().attr("slab_E_wall") = slab_E_wall;
scope().attr("slab_H_wall") = slab_H_wall;


More information about the Cplusplus-sig mailing list