Boost logo

Boost :

From: Daniel Walker (daniel.j.walker_at_[hidden])
Date: 2007-06-28 18:25:52

On 6/28/07, Alexander Nasonov <alnsn_at_[hidden]> wrote:
> Daniel Walker wrote:
> > I took a brief look at this. As far as I could tell Atry's library is
> > stateless. So, it can only support a subset of the expressions that
> > Boost.Lambda supports... namely those without state; i.e. all the
> > parameters need to be unbound. So, it can do
> >
> > _1 << _2 << _3
> >
> > ... but not ...
> >
> > cout << _1 << endl
> >
> > I'm not sure that this wins you a time savings over Boost.Lambda,
> If stateful lambda object isn't small enough to fit into boost::function
> buffer, it could save you one dynamic memory allocation for each object.

True, but I don't think this handles stateful expressions, so the
opportunity never comes up.

Actually, you can't bind an object through typeof to a type. That's
dizzying to think about. You could do some initialization in the macro
after you deduce the type, but then there are going to be
trade-offs... static variables or not supporting in one macro both

typedef BOOST_STATIC_LAMBDA_FUNCTOR(_1 << _2 << _3) left_shift_type;


BOOST_STATIC_LAMBDA_FUNCTOR(_1 + _2 * _3)::invoke(1, 3, 5)

> > but I believe it could win you a space saving if the static function can
> > be inlined.
> Or quite the opposite. Though, I hope people don't write big scary
> lambdas expressions.

Right. Actually, now that I think about it I'm getting a little
confused about scenarios where this could save you space. I think they
may be limited.

Boost list run by bdawes at, gregod at, cpdaniel at, john at