[C++-sig] Missing address-of operator for overloaded member function
Patrick Hartling
patrick at vrac.iastate.edu
Wed Mar 19 05:31:17 CET 2003
Thanks to Nicodemus' quick bug fixes, I have made quite a bit more
progress with Pyste tonight. I am now to the point where I am compiling
the generated C++ code. Now, however, I've run into a problem with
overloaded member functions wherein the address-of operator (&) is
missing in the second argument to boost::python::class_<T>::def().
I have attached an example that results in the following C++ code (using
the latest Pyste sources):
BOOST_PYTHON_MODULE(overload)
{
class_< Overload >("Overload", init< >())
.def(init< const Overload & >())
.def("data", (void (Overload::*)(int) )Overload::data)
.def("data", (int (Overload::*)() )Overload::data)
;
}
The problem appears to be that Function.PointerDeclaration() (in
declarations.py) doesn't add the '&' in the pointer-to-member case. I'm
still working with GCC 3.2, though I assume other compilers would also
fail to compile the above.
-Patrick
P.S. Pyste really is a great tool. It's precisely what I needed to
jump-start a project I had let stagnate in the last couple of months.
--
Patrick L. Hartling | Research Assistant, VRAC
patrick at vrac.iastate.edu | 2624 Howe Hall: 1.515.294.4916
http://www.137.org/patrick/ | http://www.vrac.iastate.edu/
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: overload.h
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20030318/22b2b4a6/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: overload.pyste
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20030318/22b2b4a6/attachment-0001.txt>
More information about the Cplusplus-sig
mailing list