Boost logo

Boost Users :

Subject: [Boost-users] phoenix vs. python
From: Neal Becker (ndbecker2_at_[hidden])
Date: 2011-03-03 09:05:03


Can I use phoenix lambda in boost::python? Let's see:
------------------------------------
#include <boost/python/module.hpp>
#include <boost/python/def.hpp>
#include <boost/spirit/home/phoenix.hpp>

namespace bp=boost::python;

BOOST_PYTHON_MODULE (test_phoenix) {
  bp::def ("test1", &boost::phoenix::val(1));
}
----------------------------------------

Any suggestions? Here's what gcc-4.5 says:

In file included from test_phoenix.cc:2:0:
/usr/local/src/boost_1_46_0.hg/boost/python/def.hpp: In function ‘void
boost::python::def(const char*, Fn) [with Fn =
boost::phoenix::actor<boost::phoenix::composite<boost::phoenix::reference_eval,
boost::fusion::vector<boost::phoenix::value<int>, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_> > >]’:
test_phoenix.cc:8:44: instantiated from here
/usr/local/src/boost_1_46_0.hg/boost/python/def.hpp:91:5: error: cannot pass
objects of non-trivially-copyable type ‘struct
boost::phoenix::actor<boost::phoenix::composite<boost::phoenix::reference_eval,
boost::fusion::vector<boost::phoenix::composite<boost::phoenix::reference_eval,
boost::fusion::vector<boost::phoenix::value<int>, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_> >, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_> > >’ through ‘...’
In file included from /usr/local/src/boost_1_46_0.hg/boost/python/def.hpp:11:0,
                 from test_phoenix.cc:2:
/usr/local/src/boost_1_46_0.hg/boost/python/make_function.hpp: In function
‘boost::python::api::object boost::python::make_function(F) [with F =
boost::phoenix::actor<boost::phoenix::composite<boost::phoenix::reference_eval,
boost::fusion::vector<boost::phoenix::value<int>, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_> > >]’:
/usr/local/src/boost_1_46_0.hg/boost/python/def.hpp:82:61: instantiated from
‘boost::python::api::object boost::python::detail::make_function1(T, ...) [with
T =
boost::phoenix::actor<boost::phoenix::composite<boost::phoenix::reference_eval,
boost::fusion::vector<boost::phoenix::value<int>, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_> > >]’
/usr/local/src/boost_1_46_0.hg/boost/python/def.hpp:91:5: instantiated from
‘void boost::python::def(const char*, Fn) [with Fn =
boost::phoenix::actor<boost::phoenix::composite<boost::phoenix::reference_eval,
boost::fusion::vector<boost::phoenix::value<int>, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_> > >]’
test_phoenix.cc:8:44: instantiated from here
/usr/local/src/boost_1_46_0.hg/boost/python/make_function.hpp:104:60: error: no
matching function for call to
‘get_signature(boost::phoenix::actor<boost::phoenix::composite<boost::phoenix::reference_eval,
boost::fusion::vector<boost::phoenix::value<int>, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_, boost::fusion::void_,
boost::fusion::void_, boost::fusion::void_> > >&)’


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