[C++-sig] strange behavior with respect to numeric and Booleanoverloads
Ralf W. Grosse-Kunstleve
rwgk at yahoo.com
Wed Mar 18 18:30:12 CET 2009
Very nice analysis of the pros-and-cons!
> Maybe somebody else has more ideas on this. I think you could tighten
> up the automatic conversion rules (like the > patch below does for
> int and bool), so that one would have to clarify at the call site
> which function you're calling:
>
> >> f(float(3), 3)
>
> this seems the most practical to me at the moment. It would break a
> bunch of python code , but by adding casts, the old python code could
> be made to work with boost.python bindings pre- and post- this change.
I'm very much in favor of this approach.
BTW:
> The current rule for overload resolution are simply 'first match
> in reverse order of registration'.
The rule is the other way around for constructors.
Ralf
More information about the Cplusplus-sig
mailing list