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