Best ways to declare associative arrays

helxi via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Mar 11 23:58:40 PST 2017


How would an experienced programmer declare an associative array 
of strings that has 2 keys?

My initial impression was string[string][2] my_array; which does 
not seem to work.

Here is a snippet of the code I am working on:


import std.string;
import std.stdio;


string[string] change(ref string[string] arg_array){
	//..
	arg_array["first"] = strip(readln());
	//..
	arg_array["second"] = strip(readln());
	//..
	return def;
}

void main(){
	string[string][2] test;
	change(string[string] test);
}
	


More information about the Digitalmars-d-learn mailing list