Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-11-04 10:48:30


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 

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk