Re: is expression with static if matches wrong type

2015-05-24 Thread ZombineDev via Digitalmars-d-learn
On Saturday, 23 May 2015 at 04:40:28 UTC, tcak wrote: [snip] Yup, you need to use == to match the exact type. Btw, you can use enum templates from std.traits, to accomplish the same with less code: public void setMarker(M)( size_t markerIndex, M markerValue ) if(isScalarType!M) {

Re: is expression with static if matches wrong type

2015-05-24 Thread ZombineDev via Digitalmars-d-learn
On Sunday, 24 May 2015 at 14:46:52 UTC, ZombineDev wrote: [snip] Correction: not exactly the same, because isScalar also allows wchar, dchar and const and immutable versions of those 'scalar' types.

is expression with static if matches wrong type

2015-05-22 Thread tcak via Digitalmars-d-learn
[code] import std.stdio; public void setMarker(M)( size_t markerIndex, M markerValue ) if( is(M: ulong) || is(M: long) || is(M: uint) || is(M: int) || is(M: ushort) || is(M: short) || is(M: ubyte) || is(M: byte) || is(M:

Re: is expression with static if matches wrong type

2015-05-22 Thread tcak via Digitalmars-d-learn
On Saturday, 23 May 2015 at 04:35:55 UTC, tcak wrote: [code] import std.stdio; public void setMarker(M)( size_t markerIndex, M markerValue ) if( is(M: ulong) || is(M: long) || is(M: uint) || is(M: int) || is(M: ushort) || is(M: short) ||