Do you have a better way to remove element from a array?

FrankLike via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Feb 5 05:25:35 PST 2015


Now I can remove element from a array:

module removeOne;
import std.stdio;
import std.array;
import std.algorithm;

void main()
{
    int[] aa =[1,2,3,4,5];
	
	 aa = aa[0..2] ~aa[3..$];
	 writeln(aa); //ok
	  remove(aa,1);
	 writeln(aa);//get error result
}

You will found the error result,why?

Thank you.


More information about the Digitalmars-d-learn mailing list