July 16, 2011 switch generation | ||||
---|---|---|---|---|
| ||||
This code worked in dmd 2.052: /////// ubyte[] getIncludedFileImpl(FS...)(string file) { switch(file) { foreach(F; FS) { //ct foreach //forever in love with you D case F: return cast(ubyte[]) import(F); } default: throw new Exception(format("A needed included file not found %s", file)); } assert(0); } /////// It does not work anymore. I know about switch changes but the following doesn't work either: /////// ubyte[] getIncludedFileImpl(FS...)(string file) { switch(file) { foreach(F; FS) { //ct foreach //forever in love with you D case F: return cast(ubyte[]) import(F); break; // <--- here } default: throw new Exception(format("A needed included file not found %s", file)); } assert(0); } //////// How can I fix this code? Mafi PS: I know I can be done with some ugly string mixins but I want it to work somewhat like it worked before. |
Copyright © 1999-2021 by the D Language Foundation