Boost logo

Boost Users :

Subject: [Boost-users] [Boost.Python] Binding overloaded static functions
From: Dan Bailey (drb_at_[hidden])
Date: 2009-10-19 10:42:06


Hi,

I'm sure this is really trivial, but I'm not sure how to handle
overloaded static functions with Boost.Python, and I can't figure it out
by going through the documentation.

Here's the simple example I'm trying to compile:

#include <boost/python.hpp>

using namespace boost::python;

class Test
{
public:
    Test() { }
    ~Test() { }
    
    static bool func();
    static bool func(int a);
};

BOOST_PYTHON_MODULE(test)
{
    bool (Test::*func1)() = &Test::func);
    
    class_<Test>("Test")
        //.def("func", func1)
    ;
}

Error:

src/main.cpp: In function 'void init_module_test()':
src/main.cpp:18: error: no matches converting function 'func' to type
'bool (class Test::*)()'
src/main.cpp:12: error: candidates are: static bool Test::func()
src/main.cpp:13: error: static bool Test::func(int)

How do I do this?

Thanks,
Dan


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net