Associative Array, key and value as type of string or char[]

timewulf timewulf at network-application.de
Sat Feb 2 23:00:27 PST 2013


On 03.02.2013 06:09, Ali Çehreli wrote:

> You need 'static this()':
> 
> import std.stdio;
> 
> string[string] ch_Description;
> 
> static this()
> {
>     ch_Description = [ "kill" : "kills a process",
>                        "pause" : "pauses a process" ];
> }
> 
> void main() {
>     // ...
> }
> 
> You can even make the AA immutable if it never changes:
> 
> immutable string[string] ch_Description;
> 
> Ali
> 
Thanks, I applied both and errors are gone.

Timewulf


More information about the Digitalmars-d-learn mailing list