Error with associative array initializer
Peter Neubauer
admiral.nything at gmail.com
Sat Jun 30 07:31:39 PDT 2007
I'm trying to initialize an associative array with key int and value type char[] like this:
char[][int] stuff = [
0: "abc",
1: "def",
2: "ghi"
];
... which works just fine as long as the strings are all of equal length. For the following code:
char[][int] stuff2 = [
0: "ab",
1: "def",
2: "ghi"
];
results in the error message "cannot implicitly convert expression ("def") of type char[3] to char[2]". Just the same thing happens if the first value in the array is of greater length than the others. It all depends on the first string. How can I avoid this?
More information about the Digitalmars-d-learn
mailing list