
4 Nov
2004
4 Nov
'04
3:48 p.m.
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? -- Peter Dimov http://www.pdimov.com