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

David Abrahams dave at boost-consulting.com
Sun Jun 15 18:14:33 CEST 2003


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.

>                 };
>             };
>         };
>     };
> }}

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.

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





More information about the Cplusplus-sig mailing list