On 12/19/14 5:34 AM, Stefan Seefeld wrote:
But if I declare the function f in reversed order:
BOOST_PYTHON_MODULE(test)
{
def("f", f_double);
def("f", f_int);
}
I will see "invoked f(int n = 5)" when I call f(5) and "invoked f(double d =
3.14)" when I call f(3.14) as it has to be. Why does it happen? Why does it
depend on declaration order?
It definitely shouldn't. If it does, please submit a bug report
including the test, as well as details as to what compiler and OS you
were observing the error on.
It's not a bug, it's as designed. Boost.python tries function overloads
in reverse registration order and picks the first one that works, in the
sense that all the arguments convert.
Alex
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
https://mail.python.org/mailman/listinfo/cplusplus-sig