Associative array on the heap

Freddy via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon May 18 16:55:38 PDT 2015


How do you allocate an associative array on the heap?
----
void main(){
	alias A=int[string];
	auto b=new A;
}
----
$ rdmd test
test.d(4): Error: new can only create structs, dynamic arrays or 
class objects, not int[string]'s
Failed: ["dmd", "-v", "-o-", "test.d", "-I."]


More information about the Digitalmars-d-learn mailing list