Conditional functions

Dominikus Dittes Scherkl via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jan 5 09:47:09 PST 2015


Is it possible to use static if in a template structure to have 
some member functions only for specific types?
E.g.:

struct Foo(T)
{
    ...

    T get() { ... }

    static if(isMutable!T)
    {
       void set(T x) { ... }
    }
}




More information about the Digitalmars-d-learn mailing list