On Monday, 25 August 2014 at 17:05:48 UTC, H. S. Teoh via Digitalmars-d-learn wrote:
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))

Almost... T is already a type; typeof(T) doesn't compile.

Reply via email to