|
Boost : |
From: Shunsuke Sogame (mb2act_at_[hidden])
Date: 2006-07-05 22:58:07
Joel de Guzman wrote:
> Jeff Garland wrote:
>
>> Don't get me wrong, I think the new range interface is a major usability
>> advance -- well at least for unix programmers. He actually threw me off a bit
>> with this example:
>>
>> std::string dst(...)
>> range_copy(rng|to_upper|to_lower|to_upper, dst);
>>
>> which didn't make sense (apparently it was a joke). Still, I'm pretty sure in
>> a code reading contest more programmers would understand this:
>>
>> dst.to_upper().to_lower().to_upper();
>>
>> as obviously ridiculous code.
>
> Me, I prefer the immutable and functional approach:
>
> to_upper(to_lower(to_upper(rng)))
>
> Yeah, for the record, I never liked the use of the |. With the
> plain functional syntax, the joke is very clear.
How about the following with plain syntax? :-)
some_algorithm(
file_range<boost::uint8_t>(name) | // file_iterator range
utf8_decoded | // u8_to_u32_iterator range
transformed(::newline_cvter()) | // transform_iterator range
tab_expanded(::tabsize<>::value) | // my buggy iterator
to_upper |
memoized // multi_pass iterator range
);
-- Shunsuke Sogame
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk