On Mon, Aug 25, 2014 at 03:48:10PM +0000, Jeremy DeHaan via Digitalmars-d-learn wrote: > I've done things like this before with traits and I figured that this way > should work as well, but it gives me errors instead. Perhaps someone can > point out my flaws. > > immutable(T)[] toString(T)(const(T)* str) > if(typeof(T) is dchar)//this is where the error is
The correct syntax is: if (is(typeof(T) == dchar)) When comparing two values for equality (i.e., are these two values equal to each other), use "if (a == b)". When comparing two variables for identity (i.e., do these two references point to the same data), use "if (a is b)". When comparing two types, use "is(A == B)". T -- Verbing weirds language. -- Calvin (& Hobbes)