[C++-sig] Re: return value policy for returning same python object...

Nikolay Mladenov nickm at sitius.com
Sun Jun 15 22:40:21 CEST 2003


Sorry...

David Abrahams wrote:
> 
> Nikolay Mladenov <nickm at sitius.com> writes:
> 
> > What do you think about the following?
> >
> > namespace boost { namespace python
> > {
> >      struct return_self : default_call_policies
> >     {
> >         static PyObject* postcall(PyObject *args, PyObject* ){
> >             return incref(PyTuple_GetItem(args,0));
> >         }
> >         struct result_converter
> >         {
> >             template <class T> struct apply{
> >                 struct type{
> >                     static bool convertible() {return true;}
> >                     PyObject *operator()(T) const {return 0;}
>                                            ^
> I'd like to see ---------------------------^
> 
>     typename add_reference<typenameadd_const<T>::type>::type
> 
> right here.

What is the reason for that? Shouldn't the parameter passing be
optimised away anyway? 
Not that I mind it. 

> 
> >                 };
> >             };
> >         };
> >     };
> > }}
> 
> Otherwise, it looks great!  If you'd like to write an HTML page for
> the reference manual and modify one of the tests to exercise it, I'd
> be happy to add it to the system.

Sure. 

> 
> --
> Dave Abrahams
> Boost Consulting
> www.boost-consulting.com





More information about the Cplusplus-sig mailing list