Re: Static if to compare two types are the exact same

2015-04-07 Thread w0rp via Digitalmars-d-learn
On Tuesday, 7 April 2015 at 06:37:50 UTC, Jonathan wrote: static if (is(T == V)) Are static ifs always checked outside of runtime? Is it possible for a static if condition to be undeterminable outside of runtime, or would such a condition throw a compiler error? 'static if' is always run

Re: Static if to compare two types are the exact same

2015-04-07 Thread Jonathan via Digitalmars-d-learn
static if (is(T == V)) Are static ifs always checked outside of runtime? Is it possible for a static if condition to be undeterminable outside of runtime, or would such a condition throw a compiler error?

Re: Static if to compare two types are the exact same

2015-04-06 Thread ketmar via Digitalmars-d-learn
On Mon, 06 Apr 2015 19:16:33 +, Jonathan wrote: What's the best way to do this? I'm assuming this should be best practice: http://dlang.org/traits.html#isSame struct S { } writeln(__traits(isSame, S, S)); struct S {} auto s0 = S(); auto s1 = S(); static if (is(typeof(s0) ==

Re: Static if to compare two types are the exact same

2015-04-06 Thread Andrej Mitrovic via Digitalmars-d-learn
On 4/6/15, Jonathan via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: What's the best way to do this? I'm assuming this should be best practice: http://dlang.org/traits.html#isSame struct S { } writeln(__traits(isSame, S, S)); I'm not even sure when or why this trait was