uniqStable

timotheecour timothee.cour2 at gmail.com
Mon Mar 18 19:05:33 PDT 2013


can we have something like in std.algorithm ?
it returns uniq elements in original order of appearance

Some cleanup may be needed, please send comments!

auto uniqStable(T)(T a) if(isRandomAccessRange!T){
	return zip(a,iota(a.length)).array.sort!q{a[0] < 
b[0]}.array.uniq!q{a[0]==b[0]}.array.sort!q{a[1]<b[1]}.map!q{a[0]}.array;
}


More information about the Digitalmars-d-learn mailing list