Boost Users :
Subject: Re: [Boost-users] [lambda] extending lambda functions
From: Joel de Guzman (joel_at_[hidden])
Date: 2009-03-22 20:25:55
> Hi Joel,
> On Mar 21, 9:49 pm, Joel de Guzman <j..._at_[hidden]> wrote:
>> alfC wrote:
>>> the question is what do I have to do to be able to use the following
>>> syntax instead
>>> _1 + llnorm(_2)
>> Lambda does not have such a facility.
> Ok, I believe you, I will use bind instead for the moment.
> However I am still puzzled: for example, when boost::lambda
> defines some operator+ (the one use above) it does indeed what
> we expect. What is special about operator+ compared to any other
> user defined (lazy) function defined by the user?
> (i.e. the lazy function that I want but don't know how to define in
> the context of Lambda)
> After all the operator+ above must be a function defined somewhere.
Because there is only a finite number of operators that we need to
overload. OTOH, there's an infinite number of functions. In Phoenix,
we take care of only a smallish subset related to STL algorithms
and containers (e.g. for_each, etc.). It is easy to add more lazy
standard functions if there are would be volunteers.
>> You can use Phoenix instead.
>> Phoenix (lazy) functions allow you to do that. Phoenix is intended
>> to supercede Lambda. Phoenix has been reviewed and is conditionally
>> accepted into Boost after another mini-review.
> I used Spirit a little bit and I recall that Phoenix was part of
> Spirit or something like that.
> While we wait for the Phoenix library, would you recommend to use the
> Phoenix included in Spirit?
Sure, why not? It is a very stable and mature library. Once we deal
with the review related matters, there will be some changes, but I
don't think it will be drastic.
-- Joel de Guzman http://www.boostpro.com http://spirit.sf.net
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net