correct way to create boiler plate code

dmerrio rdmerrio at gmail.com
Mon May 16 12:45:34 PDT 2011


changing the relevent code, changes the error, but it still does
not compile...

immutable funcs = ["tan"];
void createFuncs(){
	foreach(func; funcs){
		mixin("double " ~ toupper(func) ~ "(double aReal)
{return(" ~ func ~ "(aReal));}");
	}
}

new error...
Error	1	Error: argument to mixin must be a string, not
("double TAN(double aReal){return(" ~ func ~ "(aReal));}")
	C:\D\SVNProjects\trunk\xcellD\xcell1\trig.d	24


Thanks for the suggestion, any others????


More information about the Digitalmars-d-learn mailing list