[C++-sig] An issue with wrapping class trees (BPL V2)

Pearu Peterson pearu at cens.ioc.ee
Tue May 28 23:09:18 CEST 2002


On Tue, 28 May 2002, David Abrahams wrote:

> You haven't told Boost.Python that variable and symbol are derived from
> basic, so it can't convert the first argument to the exposed __repr__
> function to basic*.

Not telling that to `symbol' was intentional (as I also mentioned in
my comments) but I *did* tell that to variable:

    .add(boost::python::class_<variable
	 ,boost::python::bases<basic>  //    <<==== *** SEE THIS ***
	 ,variable_wrapper
	 //,boost::noncopyable // leads to compiler failure?!
	 >("variable")
	 .def_init(boost::python::args<>())
	 )
 
> You need to use bases<basic> in the class_ argument lists, 

Did that. See above.

> or you need to re-expose repr() separately for each derived class.

Really don't want to do that. In the real case the class `basic' has about
40 methods and the number of derived classes is about 20. So you suggest
writing about 800 method definitions. And I have not counted the
additional wrappers needed to solve the int/float argument issue...

:-(
	Pearu






More information about the Cplusplus-sig mailing list