Mercurial > projects > ldc
view lphobos/std/stdio.d @ 20:42bf2eb2973b trunk
[svn r24] * Added a simple std.traits by downs
author | lindquist |
---|---|
date | Thu, 04 Oct 2007 04:28:30 +0200 |
parents | c05ef76f1c20 |
children | 8d45266bbabe |
line wrap: on
line source
module std.stdio; void _writef(T)(T t) { //static if(is(T: Object)) _writef(t.toString()); else static if(is(T: char[])) printf("%.*s", t.length, t.ptr); else static if(is(T==int)) printf("%i", t); else static assert(false, "Cannot print "~T.stringof); } void writef(T...)(T t) { foreach (v; t) _writef(v); } void writefln(T...)(T t) { writef(t, "\n"[]); }