Christopher Bruns wrote:
On Thu, Apr 1, 2010 at 1:32 PM, Michele De Stefano
<micdestef...@gmail.com> wrote:
So, as shown into the doxygen example, you have to program a wrapper
like this one:

foo_wrap(boost::python::object pyfile) {

    mds_utils::python::oFileObj      fobj(py_file);

    foo(fobj);
}

That's clever.  I wonder how boost.python would deal with overloaded
methods that use this technique.

void foo_wrap1(boost::python::object pyfile) {}
void foo_wrap2(bar_t bar) {}

def("foo", &foo_wrap1);
def("foo", &foo_wrap2);

Would boost.python know to send "bar" objects to foo_wrap2?

Boost python's "first match" overloading would kick in here... there was a long discussion about this on the list, check the archives. Short story: order of registration matters. I have a possible alternate implementation that went dormant and hasn't been thoroughly vetted, but I'm coming back around to it now.

-t



_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to