2009/5/13 Scott McMurray
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