[C++-sig] Re: return value policy for returning same python object...
Milind Patil
milind_patil at hotmail.com
Tue Jun 10 22:23:46 CEST 2003
"David Abrahams" <dave at boost-consulting.com> wrote in message
news:uwufud67g.fsf at boost-consulting.com...
> > .def("__iadd__", (object (*)(back_reference<Y&>, int) )&do_iadd)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Why this dangerous cast? It's completely unneccessary, and I
> cautioned you against it.
What if this function is overloaded eg. also have
do_iadd (back_reference<Y&> self, char* other)
{
self.get() += Y_FromString(other);
return self.source();
}
Having a single
.def("__iadd__", &do_iadd)
invokes compilation error...
:: no matching function for call to `boost::python::class_<Y, <unnamed>::Y_Wrapper,
boost::python::detail::not_specified, boost::python::detail::not_specified>::def(const char[9],
<unknown type>)'
So, is this the recommended thing: explicit cast if overloaded, else implicit?
Thanks,
Milind
PS: Pyste does explicit casts for overloaded methods.
More information about the Cplusplus-sig
mailing list