Boost logo

Boost Users :

Subject: [Boost-users] boost python wrapping class with getter/setter with const string& arg and return type
From: MM (finjulhich_at_[hidden])
Date: 2014-10-03 05:58:48


Hi

class C {
public:
  const std::string& get_name() const;
  void set_name(const std::string&);
private:
  std::string name_;
};

given this class C, how would I expose it to python with the class property
name?

class_<C>("C").
  .add_property("name", &C::get_name, &C::set_name);

with the proper includes as in the tutorial, it fails to compile.

MM



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