[C++-sig] Py++ and 'using' declarations

Pertti Kellomäki pk at cs.tut.fi
Tue Jun 19 11:16:46 CEST 2007


Is there a way in Py++ to deal with overloaded member functions
introduced by 'using' declarations?

For example, for the following declarations, Py++ creates
the code below.

-----------------------------------------------------
class B {
public:
     void f();
};

class D : public B {
public:
     void f(int i);
     using B::f;
};
-----------------------------------------------------
// This file has been generated by Py++.
#include "boost/python.hpp"
#include "killme.hh"
namespace bp = boost::python;

BOOST_PYTHON_MODULE(killme){
     bp::class_< B >( "B" )
         .def("f", &::B::f );
     bp::class_< D, bp::bases< B > >( "D" )
         .def("f", &::D::f, ( bp::arg("i") ) );
}
-----------------------------------------------------

Compiling this with g++ results in an "unresolved overloaded
function type" error, because g++ cannot choose between
D::f() and D::f(int).
-- 
Pertti





More information about the Cplusplus-sig mailing list