Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2001-05-07 12:26:15


On Monday 07 May 2001 12:58 pm, you wrote:
> Geurt Vos wrote:
> > Concluding, IMO the low-level interface should go and only a high level
> > interface should remain:
> >
> > function();
> > function(functor)
> > void set(functor)
> > void clear();
> > bool empty() const;
> > operator()(...) // I mean several, not the ellipsis!
> >
> > I'm uncertain whether op== should be implemented...
>
> What about operator<? Without it,
> you can't make a set of these things. :-)
> Without ==, you can't use search on a vector.
>
> I have no idea what 'set, clear, empty' etc
> might be for: functions can't be set, cleared,
> or emptied. They should act like values, and be
> callable.
>
> {Have I missed something deep here?]

Prefix 'function' with 'boost::' and you've missed something :)
boost::function is a generalized function object adaptor that is declared
with some given function signature and that can contain any function object
with a compatible signature. It overloads the function call operator to call
the underlying function object's function call operator. One of its uses (the
one we're debating currently) is as a callback.

        Doug


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