[C++-sig] strange behavior with respect to numeric and Booleanoverloads
dave at boostpro.com
Wed Mar 18 20:15:15 CET 2009
on Wed Mar 18 2009, "troy d. straszheim" <troy-AT-resophonic.com> wrote:
> The current rule for overload resolution are simply 'first match in reverse order of
> registration'. You could relatively easily make this 'first match in forward order of
> registration'. The library currently has no notion of one function being a better
> match than another, for a given set of arguments. It looks like it would be
> interesting enough to implement, but it isn't clear what those rules would be or if
> the runtime cost would be worth it.
I think we know what the rules should be; Daniel W. implmented something
like that for Luabind.
> For instance, this situation:
> void fn_di(double, int);
> void fn_id(int, double);
> def("f", fn_di);
> def("f", fn_id);
> >>> f(3,3)
> In C++, of course, that's a compile-time error. In python, would you check all
> overloads for equally-good matches, and if so, throw some kind of
> ambiguous_function_call exception?
More information about the Cplusplus-sig