|
Boost : |
From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2004-11-06 06:41:11
Peter Dimov writes:
> >> I'm not sure what you mean. What functionality ought to be pushed
> >> into boost::bind?
> >
> > The ability to build an always(whatever) function object:
> >
> > f = boost::bind(t);
>
> This is not an improvement over
>
> f = constant( t );
Yep, hardly.
>
> It still needs a glue call. Also, it doesn't make much sense to use
> boost::bind for this functionality, because constants do not have any
> arguments that could be bound. The bind way to make a constant is bind(
> identity<T>(), t ).
>
> The original motivating example is this:
>
> struct button
> {
> boost::function<bool()> is_enabled;
How about
function_property< boost::function<bool()> > is_enabled;
or
function_property<bool()> is_enabled;
or even
property<bool()> is_enabled;
which makes this:
> };
>
> bool sometimes();
>
> int main()
> {
> button b;
>
> b.is_enabled = true;
> b.is_enabled = false;
> b.is_enabled = sometimes;
> }
>
work?
-- Aleksey Gurtovoy MetaCommunications Engineering
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk