Iterators Must Go

Sean Kelly sean at invisibleduck.org
Fri May 8 08:51:22 PDT 2009


Sean Kelly wrote:
> Great paper!  The only quibble I have so far is that I think iterators 
> can support sentinel-terminated containers, it just isn't terribly 
> natural to do so.

The things I particularly like:

find_end() -- Reverse iterators are a pain in the ass.  The simplicity 
of this is just fantastic.

Chain, Zip, Stride, Radial -- 100% pure awesome.

partial_sort() -- The definition of this is just ingenious.  It derives 
naturally from the range design and yet I'd never have thought of it 
otherwise.

Regarding iostream ranges, I'd have liked if there was a bit more about 
the difference in interface: put vs. push/pop.  One "benefit" of stream 
iterators is that they use the same syntax as other iterators, so it 
would be good to hear why the change in syntax for ranges isn't actually 
a design flaw.

Overall, the presentation makes a very compelling case for ranges. 
While it's /possible/ to do quite a lot with iterators, the truly 
interesting stuff is so difficult/messy that it isn't worth doing. 
Ranges are elegant and safe for even fancy things.  Nice work.



More information about the Digitalmars-d mailing list