Compile time static array issues.

Era Scarecrow rtcvb32 at yahoo.com
Sun May 29 00:36:11 PDT 2011


== Quote from bearophile (bearophileHUGS at lycos.com)'s article
> Also try:
> struct Joined {
>     string name, partof, preReq;
> }
> Joined[] attached = [
>     {"MAST", "DATA", "TES3"},
>     {"ANAM","INTV",  "FACT"}
> ];

 Coming from C, this is exactly what I first tried. However since I don't recall
the {}'s being used in D it ended up using []'s, which sounds right and yet
doesn't at the same time. Like this (Which is broken).

 Joined[] attached = [
     ["MAST", "DATA", "TES3"],
     ["ANAM","INTV",  "FACT"]
 ];

 Doing a search I got the impression I had to use 'static this()'.

 Thanks bearophile. Let's hope I don't need much more help later :P


More information about the Digitalmars-d-learn mailing list