Gabriel Sechan wrote:
> ----------------------------------------
>   
>> Date: Mon, 7 Jan 2008 02:03:31 -0800
>> From: [EMAIL PROTECTED]
>> To: [email protected]
>> Subject: Re: Introducing Cobra
>>
>> Gabriel Sechan wrote:
>>     
>>> ----------------------------------------
>>>   
>>>       
>>>> Date: Mon, 7 Jan 2008 01:41:05 -0800
>>>> From: [EMAIL PROTECTED]
>>>> To: [email protected]
>>>> Subject: Re: Introducing Cobra
>>>>
>>>> for_each(foo.getBars().begin(), foo.getBars().end(), ....)
>>>>
>>>> But a lot of C++ developers strongly resist that idiom, and sometimes
>>>> the for loop is the cleanest way to represent the work being done.
>>>>
>>>>     
>>>>         
>>> Th problem with for_each is the 3rd argument-  being forced to pass in a 
>>> function pointer or functor.
>>>       
>> ...and for that we have boost::bind and boost::lambda. :-)
>>     
>>> Personally I use foreach in perl and not in C++, just due to that.  I'd 
>>> switch to using it in C++ in a second if that was fixed.
>>>       
>> You can thank me later.
>>
>>     
> I knew about both.  I'd rather kill myself than use either of those.  They're 
> at least equally ugly, if not worse, than the code they replace.  No, I'll 
> stick to for loops uuntil there's  a real foreach loop.
>   
...and that would put you squarely in the afore mentioned camp of folks
who strongly resist that idiom. ;-)

--Chris

-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to