[C++-sig] Re: Automation of Python object retrieval

Pierre Barbier de Reuille pierre.barbier at cirad.fr
Tue Mar 30 14:11:07 CEST 2004


On Mon, 2004-03-29 at 05:10, David Abrahams wrote:

> It should be fixed in the library, but you can get around it by
> wrapping a little function in an object:
> 
>          template <class T>
>          T identity_(T x) { return x; }
> 
>          object identity(&identity_<Base*>);
>          
>          ...
>                 
>             void f(Base* b)
>             {
>                 object b = identity(b);
>                 ...
> 
>             }
> 

mmhh ... I have a problem with this. I'm using g++-3.2 and I've got the
error :

boost/boost/python/detail/invoke.hpp|76| error: no match for 
||    call to `(const 
||   
boost::python::detail::specify_a_return_value_policy_to_wrap_functions_returning<Base*>
||    ) (Base*)'


But I don't know how to specify a return value policy with this syntax.
Then, I had to write :

Base* ( *identity_Base )( Base* ) = &identity_<Base*>;
object identity( identity_Base );

If not, g++ was unable to find the type of identity_<Base*>, any clue on
this ?

Thanks,

Pierre

-- 
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