New linked list

BCS BCS at pathlink.com
Thu May 11 16:13:36 PDT 2006


Sean Kelly wrote:
> Chris Miller wrote:
> 
>> A new linked list module has been released at 
>> http://www.dprogramming.com/list.php
>> You may be wondering why another linked list; check out the FAQ to see!
> 
> 
> Very cool.  One thing... does this work:
> 
>     foreach( Person p; per.each )
>     {
>         if( p.age > 50 )
>             p.listRemove();
>     }
> 
> ie. can you remove elements within a foreach?
> 
> 
> Sean


how about:

alias void delegate(void) vvd;
vvd outs[];

foreach( Person p; per.each )
{
	if( p.age > 50 )
	outs ~= &p.listRemove;
}

foreach (act; outs)
	act();



More information about the Digitalmars-d-announce mailing list