|
Boost Users : |
Subject: Re: [Boost-users] iterators must go
From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2009-05-14 02:28:12
On Wed, May 13, 2009 at 03:28, Louis Lavery <Louis_at_[hidden]> wrote:
> Scott McMurray wrote:
>>
>> The three-iterators part was somewhat handwaved-over as well. Â Take
>> this bit of current code, for example:
>>
>> Â Â auto i = find(c.begin(), c.end(), some_pred());
>> Â Â rotate(c.begin(), i, c.end());
>>
>
> This is just a guess, but I'd be disappointed if it's
> not something like this...
>
> Range const r1... // r1 = [b,e)
>
> Range const r2 = find(r1,pred); // r2 = [i,e)
>
> Range const r3 = r1 - r2; // r3 = [b,i)
>
> Range const rot = r2 + r3; // rot = [i,e) + [b,i)
>
Well, op+ is the Chain he mentions on slide 38.
But how would you implement the op-? I don't see how a - b could
possibly be efficient with a list range, for example, since the ranges
need not overlap, and one could be a subrange of the other.
And the whole file copy example is strange, too, since programs do
drastically different things. I sure wouldn't call the program on
slide 16 a "file copy" as is implied by the previous slide.
Especially since file copy is just int main() { return (std::cout <<
std::cin.rdbuf()).fail(); }
BTW, has anyone ever actually wanted to do the inter-container partial
sort of which the presentation is so proud (slide 42)? I'm not sure
why I'd have the same data set in precisely two containers. (The
Zero-One-Infinity rule comes to mind.)
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