Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-03-30 20:40:29


Hi Peter,

It's best to post Boost.Python questions to the c++-sig:

  http://www.boost.org/more/mailing_lists.htm#cplussig

Peter Hornby <peterho_at_[hidden]> writes:

> Hi,
>
> The boost version is the Version_1_31_0 tag from the CVS repository.
> The VC version is 7.1.3088.
>
> Compiling foo.cpp (attached) results in the error reported in
> BuildLog.htm (attached). The VC options are also in the BuildLog.htm
>
> Uncommenting the line in foo.cpp that that begs you to, results in a
> clean compile. Has anybody else encountered this sort of weirdness??
> I'm getting a lot of related behaviour, but this one is simple.

This one is a VC++ bug. It makes exception specifications part of
the (member) function's type. Try

    foobar.def("set1", (void (World::*)(std::string))&World::set1)

instead.

> #include <boost/python.hpp>
> using namespace boost::python;
>
>
> class World
> {
> public:
>
> World(std::string msg): msg(msg) {} // added constructor
>
> void set1(std::string msg) throw(std::exception) { this->msg = msg; }
>
> void set2(std::string msg) { this->msg = msg; }
>
> private:
>
> std::string msg;
> };
>
> void wrap_World(class_<World> &foobar)
> {
> // foobar.def("set2", &World::set2); // OK, uncomment this and the compilation works!!
>
> foobar.def("set1", &World::set1); // Error on VC7.1
> }
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk