[C++-sig] Re: Pickling problem

Pierre Barbier de Reuille pierre.barbier at cirad.fr
Mon Mar 1 17:07:04 CET 2004


On Mon, 2004-03-01 at 17:02, David Abrahams wrote:
> Pierre Barbier de Reuille <pierre.barbier at cirad.fr> writes:
> 
> > This does not work because return_internal_reference<> requires a
> > pointer or reference. 
> 
> Yeah... but if getBase doesn't return a pointer or reference, then it
> returns by value.  And if it returns by value, the static type of the
> returned object is the same as its dynamic type, so I don't see how
> you expect to end up with a Derived object.

No, what I meant is that I cannot use return_internal_reference with a
boost::python::object as a result. Nor can I use it with a PyObject* !
I know I can directly send a Base* object, but the goal of this function
is to test the creation of a boost::python::object from C++.

> 
> > However, I think that :
> >
> > PyObject* test_base( Proxy& p )
> > {
> >   return
> > return_internal_reference<1>::result_converter::apply<Base*>::type()(
> > p.getBase() );
> > }
> >
> > gives the same result that you suggested.
> 
> Not really.  That gives the same result you were getting before with
> reference_existing_object.

Arg ... so I don't know what to do :(

-- 
Pierre Barbier de Reuille

INRA - UMR Cirad/Inra/Cnrs/Univ.MontpellierII AMAP
Botanique et Bio-informatique de l'Architecture des Plantes
TA40/PSII, Boulevard de la Lironde
34398 MONTPELLIER CEDEX 5, France

tel   : (33) 4 67 61 65 77    fax   : (33) 4 67 61 56 68 





More information about the Cplusplus-sig mailing list