http://d.puremagic.com/issues/show_bug.cgi?id=6921
Summary: Request for a 'static final switch' statement Product: D Version: unspecified Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: thatsgobb...@gmail.com --- Comment #0 from Mark LeMoine <thatsgobb...@gmail.com> 2011-11-09 11:28:40 PST --- I've often come across cases where I find it'd be handy to have a different constructor based on a passed-in template enum parameter: enum Options { Some, Many, All } class OptionManager(Options O) { static if(O == Options.Some) { alias TypeTuple!(int) TP; } else static if(O == Options.Some) { alias TypeTuple!(int, int, int) TP; } else static if(O == Options.Some) { alias TypeTuple!(int, int, int, int, int, int) TP; } else { static assert(0); } public this(TP params) { // ... } } However, this necessitates a static if-else chain, as shown. It would be quite handy to have a static final switch variant for cases like the above. Would this be something easy to implement in the D language? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------