[C++-sig] Wrapping multiple class_<T> objects
David Abrahams
dave at boost-consulting.com
Wed Nov 20 15:01:30 CET 2002
Peter Bienstman <Peter.Bienstman at rug.ac.be> writes:
> On Wednesday 20 November 2002 14:28, David Abrahams wrote:
>> Peter Bienstman <Peter.Bienstman at rug.ac.be> writes:
>> > On Wednesday 20 November 2002 14:02, David Abrahams wrote:
>> >> 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 to Python?
>> >
>> > def("slab_E_wall", slab_E_wall)
>> >
>> > won't compile.
>>
>> What do you think it's supposed to do?
>
> Perhaps I misunderstand the use of 'object',
You misunderstand the use of def(). Please read about scope here
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/boost/boost/libs/python/doc/v2/scope.html
http://www.python.org/cgi-bin/moinmoin/boost_2epython_2fmodule
--
David Abrahams
dave at boost-consulting.com * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution
More information about the Cplusplus-sig
mailing list