I used std::mem_fn and std::bind for reflection style properties.
So, I would have a class SomeClass with an AbstractProperty vector. There may be several different types of classes from AbstractProperty , such as PropertyFloat , PropertyU32 , etc.
Then in SomeClass I will bind up a std::function for AbstractProperty . I would bind execute
std::bind(std::mem_fn(&SomeClass::SomeFloatGetter), this)
For a function like setter, I would use
std::bind(std::mem_fn(&SomeClass::SomeSetterGetter), this, std::placeholders::_1)
Of course, setting functions to a class is more difficult, but I use std::function to do this. In PropertyFloat I have
typedef std::function<float(void)> GetterType;
So he installed it through a function, I would pass the first std::bind shown by me as a parameter to
typename PropertyFloat::GetterType getter
Of course, types can use templates and be more universal, but this is a compromise depending on what you are developing for.
source share