I find, when coding C++ code, that I spend a lot of time writing accessor boiler plate code, such as:
class A
{
  int x;
public:
  auto x();
  void set_x(decltype(x));
};
The whole idea of implementing accessors revolves around being able to intercept read and write accesses to them. I stumbled on this library (I'm not the author). It really makes me wonder, if, to avoid having to write boilerplate code, one could/should just write something like:
class A
{
public:
  property<int> x;
  A() {
    x.setter([this](int){ /* setter code */ });
  }
};
My question is: What techniques are available to avoid having to write a lot of boilerplate code for getters and setters?
 
     
    