libzeug
libzeug copied to clipboard
Improve Property constructors
When you create a Property with an object pointer and two method pointers, which aren't declared in the same class (e.g. in a base class), the automatical type deduction fails.
So instead of
Property<int>("value", object, &Class::getter, &Class::setter)
you have to write Property<int, Class>("value", object, &Class::getter, &Class::setter)
You could either deduct the class type using the object or using the method pointers.
Which method do you use?
This method:
template <typename Type>
template <class Object>
ValuePropertyTemplate<Type>::ValuePropertyTemplate(const std::string & name,
Object & object, const Type & (Object::*getter_pointer)() const,
void (Object::*setter_pointer)(const Type &))
: ValueProperty(name)
, m_value(new AccessorValue<Type>(object, getter_pointer, setter_pointer))
{
}