Hi,
I'm pretty new to Boost.Python, and am trying to wrap a simple class similar
to:

class Foo {
public:
    float value() const { return value_; }
    float& value() { return value_; }
private:
    float value_;
};

I have no problem wrapping value() as a read-only property, like so:

class_<Foo>("Foo")
  .add_property("value", (float (Foo::*)(void) const)&Foo::value)
  ;

But I'm having a difficult time determining how to wrap the unconventional
'setter' method for read-write property access; as you can see it returns a
non-const reference to be set rather than taking the new value as an
argument. Any suggestions?

Thanks,

Craig
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to