std.container & ranges

Ali Çehreli acehreli at yahoo.com
Thu Nov 3 11:49:28 PDT 2011


On Thu, 03 Nov 2011 22:08:31 +0400, Dmitry Olshansky wrote:

> On 03.11.2011 21:13, Steven Schveighoffer wrote:
>> The range type for a SList has a single pointer to the currently
>> iterated node. How do you remove that node without having access to the
>> head/previous pointer?
>>
>>
> removeAfter ? ;) Hm though it does hit as strange. Looking at my code, I
> usually keep previous node but only when I remove elements during
> iteration.

Matt Austern's excellent "STL Singly Linked Lists" presentation is 
relevant:

  http://accu.org/index.php/accu_branches/accu_usa/past

Slide 11 is titled "Solving the insert problem: off-by-one iterators". 
Also slide 16.

Ali


More information about the Digitalmars-d-learn mailing list