Iterators Must Go
schveiguy at yahoo.com
Mon May 11 04:03:51 PDT 2009
On Sat, 09 May 2009 12:40:34 -0400, Michel Fortin
<michel.fortin at michelf.com> wrote:
> On 2009-05-09 10:45:05 -0400, "Steven Schveighoffer"
> <schveiguy at yahoo.com> said:
>> STL iterators can be used for more than just iteration. They also
>> serve as cursors, or pointers to specific elements. If you add the
>> ability for them to check their own bounds, then they become as safe
>> as ranges, and can be used as general purpose pointers for things like
>> insertion, deletion, bi-directional traversal, things that ranges can
>> do but are clumsy at.
>> You still have the interchangable-with-pointer concept burned into
>> your brain :)
>> Think more like this:
>> for(cursor i = begin; !i.end; i++)
> So basically your cursor is a range (so it knows its bounds) with an
> added position pointer.
More information about the Digitalmars-d