Array with char-keys

BCS ao at pathlink.com
Thu May 24 13:44:36 PDT 2007


Reply to Charma,

> Hello,
> i am very new with D (i do know C++ though) so i have a maybe strange
> question. Is there any way i can make an array which has char-type
> keys? Like in php in which something like that is possible:
> array{
> "textbla" => value,
> "anotherText" => value,
> and so on...
> }
> Or maybe there is another way so i can values in an array with
> char-strings?
> 
> what i want is to save an unsorted file-list in an array, in a way so
> that i don't need to look through the whole array to find the file.
> 
> Any Idea's?
> 
> Thanks
> 

there are assortative arrays:

int[ char[] ] arr;

this will allow a string to be used as a key into a mapping (it's a hash 
under the hood). Is that what you want?





More information about the Digitalmars-d mailing list