Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2007-04-07 11:00:14


Andrey Semashev wrote:
> Hello,
>
> I'd like to ask if it is possible to make Boost.Lambda place holders
> _1, _2 and _3 compatible with Boost.Bind?
>
> The reason I ask is that I often use both these libraries which makes
> it impossible to import lambda's namespace into global and forces me
> to use some shorthand namespace aliases, like bll or lambda. On the
> other hand, as a user I don't see much difference between ::_1 and
> boost::lambda::_1. I think, if lambda used bind's placeholders it
> would gain usability.

If there are no technical reasons not to, I agree this would be nice.
And IMO they should be Proto terminals, so that libraries like Spirit
and xpressive can use them seamlessly.

   template<typename I> placeholder { typedef I type };
   proto::terminal<placeholder<mpl::int_<0> > >::type const _1 = {{}};
   proto::terminal<placeholder<mpl::int_<1> > >::type const _2 = {{}};
   ...

I'm not sure how well legacy compilers will fare with Proto, though.

FWIW, the lambda library is to be replaced with Joel de Guzman's Phoenix
library, and there is a nascent effort to port Phoenix to Proto.

(I'm leaving today for a week-long vacation. I'll be on email only off
and on.)

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

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