
Shunsuke Sogame wrote:
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 );
Hmmm... lemme see... I'm not sure if I understand your code precisely, but, maybe something like: pipeline< utf8_decoded , transformed<::newline_cvter> , tab_expanded<::tabsize<>::value> , to_upper , memoized> f; file_range<boost::uint8_t> rng(name); some_algorithm(transform(rng, f)); Regards, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net