Thread overview
Associative arrays with dynamic strings
Sep 20, 2002
Robert M. Münch
Sep 20, 2002
Patrick Down
Sep 20, 2002
MicroWizard
Sep 22, 2002
Walter
September 20, 2002
Hi, I would like to do something like this:

char[] [char[]] assoc_array;

assoc_array["Hello"] = "Test";

But this doesn't compile:  cannot implicitly convert wchar[5] to int The problem doesn't show up if I use: = 3 for example. Any idea?

--
Robert M. Münch
IT & Management Freelancer
Mobile: +49 (0)177 2452 802
Fax   : +49 (0)721 8408 9112
Web   : http://www.robertmuench.de



September 20, 2002
"Robert M. Münch" <robert.muench@robertmuench.de> wrote in news:amfhoe$2097 $1@digitaldaemon.com:

> Hi, I would like to do something like this:
> 
> char[] [char[]] assoc_array;
> 
> assoc_array["Hello"] = "Test";

I've run into this before.  You can declare
it like this:

char[char[]][] assoc_array;


September 20, 2002
I see you have faced two different problems simultaneously. One was pointed out by Patrick. (You have defined different type of indices in one order and used them in reversed order, first is int, second is char[])

But the other problem is with the present D implementation.
String constants have the type of wchar[n], but the assoc array works
only with char[]. It implies you have to cast char[] and wchar[]
very often and vice versa. I hope these kind of problems will be solved
when the specification of D gets clearer.

I think wchar[] is good for UTF8-UTF16-UNICODE representations, but it is inconvenient to cast string constants always.

Walter surely could give us proper explanation.

Regards,
Tamas (microwizard@ax.hu)

In article <amfhoe$2097$1@digitaldaemon.com>, Robert M. Münch says...
>
>Hi, I would like to do something like this:
>
>char[] [char[]] assoc_array;
>
>assoc_array["Hello"] = "Test";
>
>But this doesn't compile:  cannot implicitly convert wchar[5] to int The problem doesn't show up if I use: = 3 for example. Any idea?
>
>--
>Robert M. Münch
>IT & Management Freelancer
>Mobile: +49 (0)177 2452 802
>Fax   : +49 (0)721 8408 9112
>Web   : http://www.robertmuench.de


September 22, 2002
I just need to fix dynamic arrays to work with wchar[]'s.

"MicroWizard" <MicroWizard_member@pathlink.com> wrote in message news:amg5j5$2omd$1@digitaldaemon.com...
> I see you have faced two different problems simultaneously. One was
pointed out
> by Patrick. (You have defined different type of indices in one order and
used
> them in reversed order, first is int, second is char[])
>
> But the other problem is with the present D implementation.
> String constants have the type of wchar[n], but the assoc array works
> only with char[]. It implies you have to cast char[] and wchar[]
> very often and vice versa. I hope these kind of problems will be solved
> when the specification of D gets clearer.
>
> I think wchar[] is good for UTF8-UTF16-UNICODE representations, but it is inconvenient to cast string constants always.
>
> Walter surely could give us proper explanation.