Boost logo

Boost Users :

Subject: Re: [Boost-users] iterators must go
From: Daniel James (daniel_james_at_[hidden])
Date: 2009-05-15 17:15:20


2009/5/13 Scott McMurray <me22.ca+boost_at_[hidden]>:
>
> Very persuasive, but it's careful to touch only the examples that look
> nice.  Note, for example, that every range was a whole container.
>
> 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());
>
> How do you do that nicely with ranges, when he has find returning a
> range?  (Since right now, it implicitly actually returns 2 ranges.)

He claims that D's stdlib is a superset of the STL. It certainly
supports this case:

    import std.algorithm;
    import std.stdio;

    void main() {
        int[] arr = [4,5,6,7,1,2,3];
        bringToFront(arr, find(arr, 1));
        assert(arr == [1,2,3,4,5,6,7]);

        writeln(arr);
    }

http://www.digimars.com/d/2.0/phobos/std_algorithm.html#bringToFront

The relevant point is that bringToFront's first range can step over
the second range.

Daniel


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