How to remove element from an SList?

Chris Pons cmpons at gmail.com
Tue Mar 27 17:02:52 PDT 2012


Right now i'm struggling with trying to understand how to remove 
an element from a n SList. I only want to remove one element, not 
a range of elements. I also don't want to use an Array because I 
will have to reshuffle elements to take care of the empty spot 
when I remove it.

The only thing I've seen so far is find from std. algorithm and 
linearRemove. However I can't get find to work and I don't 
exactly believe linearRemove will work either because afaik that 
removes up to the index specified? I'm not to clear on this.

Here's a simplified example of what I was trying:

SList!int intList;
intList.insert( 1 );
auto a = find( intList, 1 );
intList.linearRemove( a );


More information about the Digitalmars-d-learn mailing list