Re: null as parametr

2016-07-31 Thread Andrew Godfrey via Digitalmars-d-learn
On Sunday, 31 July 2016 at 05:41:55 UTC, AntonSotov wrote: 2 Seb Thank you! is (T: typeof (null)) - very comfortable An example of Seb's warning: What happens if you have: string s = null; MyFunc(s); I'm guessing it doesn't do what you want. But it isn't clear what you want - null is a

Re: null as parametr

2016-07-30 Thread AntonSotov via Digitalmars-d-learn
2 Seb Thank you! is (T: typeof (null)) - very comfortable

Re: null as parametr

2016-07-30 Thread Seb via Digitalmars-d-learn
On Sunday, 31 July 2016 at 05:22:40 UTC, AntonSotov wrote: 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

null as parametr

2016-07-30 Thread AntonSotov via Digitalmars-d-learn
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)