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

Peter Bienstman Peter.Bienstman at rug.ac.be
Wed Nov 20 14:45:39 CET 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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', but I want to create C++ objects 
and have them accessible through an identifier in Python.

This is the compile error message:

/home/pbienst/boost_1_29_0/boost/python/make_function.hpp: In function
   `boost::python::api::object boost::python::make_function(F) [with F =
   boost::python::api::object]':
/home/pbienst/boost_1_29_0/boost/python/def.hpp:78:   instantiated from `void 
boost::python::def(const char*, Fn) [with Fn = boost::python::api::object]'
camfr/camfr_wrap.cpp:1010:   instantiated from here
/home/pbienst/boost_1_29_0/boost/python/make_function.hpp:23: incomplete type 
`
   boost::python::detail::arg_tuple_size<boost::python::api::object>' does not
   have member `value'

Thanks!

Peter

- -- 
- ------------------------------------------------
Peter Bienstman
Ghent University, Dep. of Information Technology
Sint-Pietersnieuwstraat 41, B-9000 Gent, Belgium
tel: +32 9 264 34 45, fax: +32 9 264 35 93
email: Peter.Bienstman at rug.ac.be
- ------------------------------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE925ID4dgPAIjyquoRAi4jAKCQ6Kp8ieEaNbwYTPPSc7A0v4OUNwCeOln4
pbtxBOYTtJoQMesmidnMMzw=
=KHCj
-----END PGP SIGNATURE-----





More information about the Cplusplus-sig mailing list