[C++-sig] Conversion of python files to C++ ostreams
troy d. straszheim
troy at resophonic.com
Sat Apr 3 21:01:45 CEST 2010
Christopher Bruns wrote:
> On Thu, Apr 1, 2010 at 1:32 PM, Michele De Stefano
> <micdestefano at 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
More information about the Cplusplus-sig
mailing list