Short list with things to finish for D2

grauzone none at example.net
Thu Nov 19 09:11:11 PST 2009


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.



More information about the Digitalmars-d mailing list