Boost logo

Boost Users :

From: Jörg Wintner (hueftknick_at_[hidden])
Date: 2008-05-07 20:05:46


Hi all,

trying to compile one of the simplest examples in the doc (see code below) for the python-binding of boost::parameters using Visual Studio 2005 prof, I get the following error:

error C2440: 'initializing' : cannot convert from 'const boost::parameter::aux::use_default_tag' to 'unsigned int'
...\boost_1_35_0\boost\parameter\aux_\maybe.hpp on line 59

boost::python works well in binding non-boost::parameter-functions. Also, "boost_1_35_0\libs\parameter\test\python_test.cpp" compiles without errors. When all parameters of window::open(..) are set as being 'required' instead of 'optional', the code below finally compiles, too.

Somebody, please give me a hint, I don't know where to start. Thanks in advance!

/* from: http://www.boost.org/doc/libs/1_35_0/libs/parameter/doc/html/python.html */
#include <boost/parameter/keyword.hpp>
#include <boost/parameter/preprocessor.hpp>
#include <boost/parameter/python.hpp>
#include <boost/python.hpp>

BOOST_PARAMETER_KEYWORD(tag, title)
BOOST_PARAMETER_KEYWORD(tag, width)
BOOST_PARAMETER_KEYWORD(tag, height)

class window
{
public:
    BOOST_PARAMETER_MEMBER_FUNCTION(
      (void), open, tag,
      (required (title, (std::string)))
      (optional (width, (unsigned), 400)
                (height, (unsigned), 400))
    )
    {
        
    }
};

struct open_fwd
{
    template <class A0, class A1, class A2>
    void operator()(
        boost::type<void>, window& self
      , A0 const& a0, A1 const& a1, A2 const& a2
    )
    {
        self.open(a0, a1, a2);
    }
};

BOOST_PYTHON_MODULE(my_module)
{
    using namespace boost::python;
    namespace py = boost::parameter::python;
    namespace mpl = boost::mpl;

    class_<window>("window")
        .def(
            "open", py::function<
                open_fwd
              , mpl::vector<
                    void
                  , tag::title(std::string)
                  , tag::width*(unsigned)
                  , tag::height*(unsigned)
>
>()
        );
}

-- 
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/?mc=sv_ext_mf@gmx

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