diff --git a/examples/demo.cpp b/examples/demo.cpp index f16c80b..4999d39 100644 --- a/examples/demo.cpp +++ b/examples/demo.cpp @@ -15,7 +15,7 @@ int convert(const std::string &value) { struct foo : settable::settable { foo() { - register_setter("x", &x); + REGISTER_MEMBER(int, x); } int x; diff --git a/settable.hpp b/settable.hpp index d668135..3a9f975 100644 --- a/settable.hpp +++ b/settable.hpp @@ -52,6 +52,9 @@ public: void *ptr; }; +#define REGISTER_MEMBER(Type, Attribute) \ + this->register_setter(#Attribute, &Attribute); + class settable { public: void set_attribute(const std::string &attr, const std::string &value) {