Boost logo

Boost :

Subject: Re: [boost] De Bruijn Bind (alternate bind syntax) Interest?
From: Joel de Guzman (joel_at_[hidden])
Date: 2010-09-03 22:15:20


On 9/4/2010 9:55 AM, OvermindDL1 wrote:
> On Fri, Sep 3, 2010 at 5:46 PM, Joel de Guzman
> <joel_at_[hidden]> wrote:
>> We once had outer. The outer solution looked like this:
>>
>> for_each(_1,
>> lambda
>> [
>> push_back(_1, outer(_2))
>> ]
>> )
>>
>> How would that look like if you extend phoenix with your syntax?
>>
>> It would be good to tackle this through practical use-cases
>> and using plain C++ terms. Too much formality hurts my brain.
>> If this use-case is too simplistic, then perhaps you can provide
>> something more elaborate, yet still practical.
>
> Actually that is pretty close to what I was describing, but imagine
> outer being like this to indicate how many levels up to go:
>
> for_each(_1,
> lambda
> [
> push_back(_1, outer<1>(_2))
> ]
> )
>
> Then simplify the syntax by doing something like outer<1,2>, which
> could then have a predefined value called _1_2 or so...
>
> I like outer, guess it would be fully powerful if it could specify how
> many 'outer' levels to go out to with a template param like the above?

Yep. We had that too. There is also the possibility to write your own
scoped place-holders like _1_2.

I should reinstate them. I don't recall now why they were decommissioned.
Perhaps because you can do what it does with local variables and lambda?
I don't recall anymore.

Regards,

-- 
Joel de Guzman
http://www.boostpro.com
http://spirit.sf.net

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