
Peter Dimov writes:
When using boost::function<bool()> to implement event callbacks such as is_visible or is_enabled, it's very convenient to pass 'true' or 'false' directly, instead of going through bind( identity<bool>(), true ). An UI button I recently did even had separate bool properties in addition to the callback events for these reasons.
I wonder whether it's reasonable to add
this_type& operator=( T const & t );
to function<T()> that does the obvious thing.
Of course f = t; is merely a shorthand way of spelling f = boost::lambda::constant(t), but a dependency on lambda isn't always desirable.
Thoughts?
http://thread.gmane.org/gmane.comp.lib.boost.devel/76774 http://thread.gmane.org/gmane.comp.lib.boost.devel/76778 http://thread.gmane.org/gmane.comp.lib.boost.devel/76784 I ended up with 'f = always( whatever )', which grew on me to the point that I don't wish for the above anymore. FWIW. -- Aleksey Gurtovoy MetaCommunications Engineering