Multidimension AA's and remove

NX via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Sep 11 22:54:10 PDT 2015


On Saturday, 12 September 2015 at 03:44:50 UTC, Prudence wrote:
> At the very least: Is T[][S] an associative array with keys of 
> type S and values of an array of type T or is it backwards? 
> Also, how to disambiguate
>
> Thanks.

Indeed.

void main()
{
	import std.stdio : writeln, std.algorithm.mutation : remove;
	
	int[][string] heh = [ "hah":[ 0, 10, 15, 20 ] ];
	heh["hah"][0] = 5;
	foreach(var; heh["hah"])
		writeln(var);
	writeln();
	heh["hah"] = remove!(c => (c == 15))(heh["hah"]);
	foreach(var; heh["hah"])
		writeln(var);
}
Giving me:
5
10
15
20

5
10
20


More information about the Digitalmars-d-learn mailing list