[C++-sig] Problem with overloading between int and double

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Thu May 20 04:56:42 CEST 2010


> I admit it's not a very satisfying solution.  Maybe someone else has a better idea,
> but I think fixing this in Boost.Python would require a lot of work.


Troy did the work already but it isn't in the trunk.
IIUC the additional price is increased extension sizes (but Troy's changes
seem to go far beyond an enhanced overload mechanism so it is difficult to
tell).

There is another way to achieve what you want: just do the overload
resolution yourself. Wrap a function that takes boost::python::object
as the argument, then use extract<> or the raw Python API to inspect
the object and call the best C++ overload.

Ralf


More information about the Cplusplus-sig mailing list