This can be changed. Let me demonstrate.
Code:
template<typename T, typename Class, void (Class::* setter_)(const T&), const T& (Class::*getter_)() const>
class property
{
typedef property self_type;
public:
property(Class& obj)
:object_(obj)
{}
operator T() const
{
return object_.getter_();
}
self_type& operator=(const T&t)
{
object_.setter_(t);
return *this;
}
private:
Class& object_;
};
Given, I did not compile and test this, but try it - it should work.
That leaves just 4 bytes overhead.
And mate - 4KB of memory is nothing.