Iterators Must Go

Steven Schveighoffer schveiguy at yahoo.com
Fri May 8 08:45:21 PDT 2009


On Thu, 07 May 2009 23:01:20 -0400, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> The slides from my keynote at BoostCon 2009 (www.boostcon.com) are now  
> available from:
>
> http://www.boostcon.com/site-media/var/sphene/sphwiki/attachment/2009/05/08/iterators-must-go.pdf
>
> The talk went so well, the urge to brag is too mighty to resist. I mean  
> it's not everyday that several people come and tell they've literally  
> lost sleep and focus on other talks because of thinking about ranges.  
> Also, there was a definite feel of "before" and "after". In short, the  
> talk has generated a great deal of interest in both D proper and in the  
> Boost community rewriting the STL entirely in terms of ranges.

A good paper.

You still have not addressed the usage of iterators as general data  
structure pointers.  As far as I can tell, ranges do not implement this.

i.e. find surrounding elements of an element.

With iterators:

auto iter = container.find(elem);
auto elembefore = iter - 1;
auto elemafter = iter + 1;

Assuming incrementing and decrementing an iterator is checked for  
out-of-bounds.

-Steve



More information about the Digitalmars-d mailing list