Compare types with `static if` in template function.

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jul 29 10:52:44 PDT 2015


On 07/29/2015 10:48 AM, vladde wrote:

 >          static if(is(typeof(c) == dchar) || is(typeof(c) == char))
 >          {
 >              slots[xy.y][xy.x].character = c;
 >          }
 >          else if(is(typeof(c) == fg))

I don't know whether it is the reason here but you fell for one of the D 
traps. :( Most definitely, you want an 'else static if' there.

Otherwise, for the fg case, what ends up in your code to be compiled is 
this:

   if(is(typeof(c) == fg))

Ali



More information about the Digitalmars-d-learn mailing list