Boost logo

Boost Users :

Subject: Re: [Boost-users] phoenix vs. python
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-03-03 10:20:29


At Thu, 03 Mar 2011 09:05:03 -0500,
Neal Becker wrote:
>
> 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:

Do the Boost.Python docs say you can wrap pointers to arbitrary
function objects that way? I seriously doubt it. Part of the reason
it can't work is that you're passing a pointer (pointers to actual
functions are special) and part is that phoenix functions are
compile-time polymorphic and take an arbitrary number of arguments.
Boost.Python can't deduce the desired properties of the python
function you want to generate from that.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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