On Thu, Jan 15, 2009 at 6:57 PM, Hoenir <mrmoc...@gmx.de> wrote: > Why is that "is" used here: > static if(is(a == char*)) > > I know is is normally used for identity comparison, but what does it do > here?
is(blah blah) is a completely different thing than "x is y" ;) is() is used to test, at compile time, for some type-related information. It also has some stranger forms that allows it to introduce symbols that are bound to smaller pieces of types (for example, it can be used to get the return type or parameter types of a function or delegate). is(a == char*) returns true if the type 'a' is char*, and false otherwise. > Also, I've never seen something like that (I mean that ":"): > else static if(is(a : int)) The : is similar to ==, but means "implicitly." While is(a == int) returns true only if the type 'a' is int, is(a : int) returns true if the type 'a' is _implicitly_ convertible to int, including things like short and dchar.