Removing multiple elements from array

aldanor i.s.smirnov at gmail.com
Sat Dec 21 17:39:15 PST 2013


On Saturday, 21 December 2013 at 21:49:01 UTC, MrSmith wrote:
> On Saturday, 21 December 2013 at 00:47:04 UTC, aldanor wrote:
>> Is there an efficient method to remove elements with multiple 
>> (compile-time-unknown) indices from an array? I currently do 
>> something like
>>
>> 		if (!index.empty)
>> 			foreach (i; index.sort.reverse)
>> 				a = a.remove(i);
>>
>> ... which looks a bit awkward.
>
> just use foreach_reverse

Wow, I never knew it is a keyword, thank you!


More information about the Digitalmars-d-learn mailing list