Andrei Alexandrescu wrote:
You mean use a struct for the string-value pair? A struct cannot have a ref member, so it would still need to store a pointer. (But maybe I misunderstood the point.)

Like this:

void main(string[] commandline) {
        struct Args {
                string param1 = "can even have default arguments";
                int param2;
        }
        Args args = getopt!(Args)(commandline);
        writefln("param1 = %s", args.param1);
}

No pointers. Instead of returning it, struct could be passed by ref, too.

Reply via email to