Reply to Hoenir,
BCS schrieb:
I have a partial solution here:
http://www.dsource.org/projects/scrapple/browser/trunk/log_api/LogAPI
.d
Feel free to steal whatever you want from it. If you are really
adventures and want to, I can get you SVN access and you can dump
stuff back into that.
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?
Also, I've never seen something like that (I mean that ":"): else
static if(is(a : int))
the code with some annotations. It should be pointed out that the code is
only designed to deal with C types)
// If the variable is a C-string, print it as such
static if(is(a == char*)) writef(`, "%s"`, t[i][0..strlen(t[i])]);
// if the variable is implicitly castable to int print it as such
else static if(is(a : int)) writef(", %d", t[i]);
// otherwise print the type name and the value (hope write can deal with it)
else writef(", [%s]%s", a.stringof,t[i]);