user841550
user841550

Reputation: 1075

How to declare and initialize an associative array with string as keys and arrays as value

I am new to D. I am looking for the equivalent of this C++ declaration

typedef std::vector<std::string> the_value;
std::map<std::string,the_value> the_table;

Upvotes: 5

Views: 237

Answers (1)

Kozzi11
Kozzi11

Reputation: 2413

You want something like this probably:

string[][string] the_table;

example:

import std.stdio;

void main(string[] args)
{
    string[][string] the_table = ["k1" : ["v1", "v2"], "k2" : ["v3", "v4"]];
    writeln(the_table);
}

Upvotes: 4

Related Questions