[C++-sig] make_constructor and BOOST_PYTHON_FUNCTION_OVERLOADS
Holger Brandsmeier
brandsmeier at gmx.de
Thu Feb 2 15:30:00 CET 2012
Dear list,
how can I combine make_constructor() and BOOST_PYTHON_FUNCTION_OVERLOADS()?
I have a static member function in a class that "acts like a
constructors", in the sense that it returns a shared pointer to the
class. The function has default arguments, thats why I was thinking of
using BOOST_PYTHON_FUNCTION_OVERLOADS.
For usual member functions I've been using it like this:
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(Operator_apply, apply, 2, 5)
[...]
.def("apply", &ClassT::apply, Operator_apply() )
So for the constructor I thought probably I should use it like
BOOST_PYTHON_FUNCTION_OVERLOADS(fPfemSpace_create, create, 2, 3)
[...]
.def("__init__", make_constructor( &ClassT::create ),
fPfemSpace_create())
but that fails with the error:
/usr/include/boost/python/class.hpp:598:37: error: no matching
function for call to 'get_signature'
name, overloads, *this, detail::get_signature(sig));
I tried out a few other variations for ".def(" but I didn't find the
right one yet. Is there a way to combine make_constructor with
BOOST_PYTHON_FUNCTION_OVERLOADS?
-Holger
More information about the Cplusplus-sig
mailing list