digitalmars.D.learn - switch generation
- Mafi (34/34) Jul 16 2011 This code worked in dmd 2.052:
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.
Jul 16 2011