Boost logo

Boost :

From: rwgk_at_[hidden]
Date: 2001-05-14 21:13:51


Thanks David, your suggestion actually works!

Unfortunately, the same problem keeps creeping up with
many other friend functions (e.g. all from_python).
Adding function declarations all over the place does
not seem to be a viable option to me. The source code would get
really cluttered. Instead I will try to file a bug report.
Hopefully this problem will get fixed in the next release.

Thanks!
        Ralf

--- In boost_at_y..., "David Abrahams" <abrahams_at_m...> wrote:
> Hi Ralf,
>
> You might try adding some function declarations in the calling
functions,
> e.g.:
>
> friend T* from_python(PyObject* obj, boost::python::type<T*>)
> {
> T* non_null_from_python(PyObject*, boost::python::type<T*>);
> if (obj == Py_None)
> return 0;
> else
> return non_null_from_python(obj, boost::python::type<T*>
());
> }
> ...
> // Convert to T&
> friend T& from_python(PyObject* p, boost::python::type<T&>)
> { T* non_null_from_python(PyObject*,
boost::python::type<T*>);
> return
> *boost::python::detail::check_non_null(non_null_from_python(p,
> boost::python::type<T*>())); }
>
> Best of luck,
> Dave


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk