Boost logo

Boost Users :

Subject: [Boost-users] Overloading errors
From: A B (python6009_at_[hidden])
Date: 2009-04-17 20:25:14

Does anyone know why the following sample fails (it was adapted from
the boost overloading example) and how to do this correctly. Thanks in

#include <boost/python/module.hpp>
#include <boost/python/def.hpp>
#include <boost/python/args.hpp>
#include <boost/python/tuple.hpp>
#include <boost/python/class.hpp>
#include <boost/python/overloads.hpp>
#include <boost/python/return_internal_reference.hpp>

using namespace boost::python;

struct X


    int f(int x, double y = 4.25, char const* z = "wow")


        return x;


    int f(int x, bool b = true) {

        return x;



BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(f_member_overloads, X::f, 1, 3)



    class_<X>("X", "This is X's docstring")

        .def("f1", &X::f,

             f_member_overloads(args("x", "y", "z"), "f's docstring"





g++ -fpic -shared -o test.cpp -lpython2.4 -lboost_python

test.cpp: In function ‘void init_module_args_ext()’:

test.cpp:31: error: no matching function for call to
‘boost::python::class_<X, boost::python::detail::not_specified,
boost::python::detail::not_specified>::def(const char [3], <unresolved
overloaded function type>,
boost::python::default_call_policies>, f_member_overloads>)’

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at