std.path.buildPath() and string enumeration

bearophile bearophileHUGS at lycos.com
Wed May 30 11:55:16 PDT 2012


A better solution is to use:

struct Path {
     enum : string {
         log1 = "/var/log1",
         log2 = "/var/log2"
     }
}


Or even just:

struct Path {
     enum string log1 = "/var/log1",
                 log2 = "/var/log2";
}

(In D structs, classes and enums start with an upper case).

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list