
On Mon, Oct 19, 2009 at 3:42 PM, Dan Bailey
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
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
Try a static cast to identify the overload you want:
BOOST_PYTHON_MODULE(test)
{
class_<Test>("Test").def("func", static_cast