[C++-sig] Assert's in boost.python when instanciating class

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Tue May 6 10:27:12 CEST 2003


--- Sean Dunn <sean_dunn1 at yahoo.com> wrote:
> class_<SimpleTest>("SimpleTest")
> 	.def_readwrite("val",  &SimpleTest::val)
> ;

Please try this:

#include <boost/python/return_value_policy.hpp>
#include <boost/python/return_by_value.hpp>

class_<SimpleTest>("SimpleTest")
  .add_property("val",
    make_getter(&SimpleTest::val, return_value_policy<return_by_value()),
    make_setter(&SimpleTest::val))
;                              

If it works I am sure David can explain why (I cannot).
Ralf


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com




More information about the Cplusplus-sig mailing list