Boost logo

Boost :

From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2004-04-13 07:18:50


Hi Arkadiy,

Arkadiy Vertleyb ha escrito:

[...]

> As far as Lambda is concerned, Boost.Function can abstract you from the
> functor type (although at the expence of some overhead):
>
> std::set<int, boost::function<bool(int)> > s(_1 < _2);

Yep, this has been previously discussed. Three problems here:

1) boost::function adds an extra indirection penalty.
2) Having to provide the function at iintialization time is
cumbersome.
3) some valuable type info is lost. To continue with the
std::set example, set<T,boost::function<bool(const T&,const T&,)>
flattens out every possible lambda expression we might plug in.
This might not be desirable.

Besides, I think such a static lambda library could be useful
for more far-fetched purposes, along the line of enriching
the code-producing capabilities of MPL.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


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