[C++-sig] Conversion of python files to C++ ostreams

Christopher Bruns cmbruns at stanford.edu
Sat Apr 3 19:26:23 CEST 2010


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?


More information about the Cplusplus-sig mailing list