
12 Nov
2004
12 Nov
'04
2:47 p.m.
Aleksey Gurtovoy wrote:
How about
function_property< boost::function<bool()> > is_enabled;
or
function_property<bool()> is_enabled;
or even
property<bool()> is_enabled;
FWIW, I went with inline bool true_ { return true; } inline bool false_ { return false; } which allows is_enabled = true_; I don't like the word "property", or the property-based style of programming, in general. :-) As a side benefit, false_ comes in handy for on_click, too (which is a function<void()>). One other observation: keeping a function<> always initialized with the appropriate default (a variation of the Null Object pattern) leads to much cleaner code.