Boost logo

Boost Users :

Subject: Re: [Boost-users] [Phoenix] for_each calling push_back for stl containers
From: Joel de Guzman (joel_at_[hidden])
Date: 2012-07-09 20:52:30


On 7/10/2012 8:44 AM, Joel de Guzman wrote:
> On 7/10/2012 7:24 AM, Jeffrey Lee Hellrung, Jr. wrote:
>> On Mon, Jul 9, 2012 at 4:14 PM, Joel de Guzman <joel_at_[hidden]
>> <mailto:joel_at_[hidden]>> wrote:
>> [...]
>>
>> Only the de-Bruijn syntax can do this as well. Please read up before
>> you bash the thing ;-)
>>
>>
>> OT: I can't tell if this was directed at me or the OP, and what was or could be bashed,
>> but I certainly didn't intend to bash neither Phoenix nor de Bruijn syntax!
>
> Pardon me, it's not directed at you :-)
>
> For reference:
>
> Ryan wrote:
>
> > Man that is ugly. I expected using only pure lazy methods to clean
> > up the call. Why did the lambda become necessary?

Looking back at the code. I think it's only "ugly" as written.
With proper "using" stuff, it can be clean:

   for_each(_1,
     lambda(_a = ref(string_tokens))
     [
       push_back(_a, _1)
     ]
   )

Actually, it could be simply:

   for_each(_1,
     lambda
     [
       push_back(ref(string_tokens), _1)
     ]
   )

Regards,

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

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