null as parametr

AntonSotov via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jul 30 22:22:40 PDT 2016


import std.stdio;

void myFunc(T)(in T val) {
     static if(is(T == string)) {
         writeln("string: ", val);
     }
     static if(is(T : long)) {
         writeln("long: ", val);
     }
     static if                         // WHAT HERE ?
         writeln("null");
     }
}

int main(string[] args)
{
     myFunc("abc");
     myFunc(123);
     myFunc(null);
     return 0;
}
//--------------------------------------------------
How to transfer <null> as parameter type?


More information about the Digitalmars-d-learn mailing list