[C++-sig] Dissimilar Overloads

Scott A. Smith ssmith at magnet.fsu.edu
Wed Dec 4 21:06:29 CET 2002


> Leo wrote:

> thanx a lot for your  mail, could you please break
> down you intepretations and languages more simpler, I
> couldn't figure out much from you mail.

Sure Leo. I have a C++ function, say f, that is overloaded:

int f(int x, int y, int z);
void f(double d, complex z);

What is the easiest way to expose these using Boost.Python?
I had hoped something like the following might work:

> > #include <boost/python/def.hpp>
> > using namespace boost::python;
> > 
> > int f(int x, int y, int z);
> > void f(double d, complex z);
> > 
> > BOOST_PYTHON_MODULE(xxx)
> > {
> >    def("f", f, args("x", "y", "z"));
> >    def("f", f, args("d", "y"));
> > }

But that doesn't work. Note that the function f is not part
of any class.

Thanks
Scott




More information about the Cplusplus-sig mailing list