[Issue 6921] Request for a 'static final switch' statement

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun May 27 05:53:08 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=6921


bearophile_hugs at eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs at eml.cc


--- Comment #1 from bearophile_hugs at eml.cc 2012-05-27 05:54:55 PDT ---
Do you mean something like this? It's handy:


enum Options {
    Some, Many, All
}

class OptionManager(Options opt) {
    static final switch(opt) {
        case Options.Some:
            alias TypeTuple!(int) TP;
            break;
        case Options.Many:
            alias TypeTuple!(int, int, int) TP;
            break;
        case Options.All:
            alias TypeTuple!(int, int, int, int, int, int) TP;
            break;
    }

    public this(TP params) {
        // ...
    }
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list