Boost logo

Boost Users :

Subject: [Boost-users] [python][lambda] thin wrapper functions using boost.lambda
From: Václav Šmilauer (eudoxos_at_[hidden])
Date: 2009-07-20 02:09:27


Hi,

I would like to use lambda functions to define thin wrapper functions in
boost::python, like

struct A{ void meth1(); };
[...]
python::class_<A>("A").def("meth1",lambda::bind(&A::meth1,lambda::_1));

and I am getting "error: no matching function for call to 'get_signature
[...]' " from the compiler. Reading boost::lambda documentation
(http://www.boost.org/doc/libs/1_39_0/doc/html/lambda/using_library.html#lambda.parameter_and_return_types):

"""The basic rule is that a lambda function can be called with arguments
of any types, as long as the lambda expression with substitutions
performed is a valid C++ expression."""

Is there a way to enforce parameter types, so that boost::python can get
the signature? Or, more generally, is it somehow possible to use such
in-place functions to create the thin wrappers?

Many thanks,

Vaclav


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