[C++-sig] Boost.Python Function overload resolution order
David Abrahams
dave at boost-consulting.com
Wed Nov 27 01:32:34 CET 2002
I just discovered something surprising in Boost.Python's function
overload resolution: overloads are tried in the _reverse_ order in
which they are def'ed. I actually thought it worked the opposite way!
Changing this could break user code which relies on the current order:
void f(float);
void g(int);
...
def("f", f);
def("f", g);
If we change the rules so that the first def() is tried first, g will
neve be called. However, I consider the current rule to be
counter-intuitive and surprising. Quite a dilemma.
Opinions?
--
David Abrahams
dave at boost-consulting.com * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution
More information about the Cplusplus-sig
mailing list