Mercurial > projects > ldc
comparison lphobos/std/stdio.d @ 18:c05ef76f1c20 trunk
[svn r22] * Forgot to add std.stdio
author | lindquist |
---|---|
date | Thu, 04 Oct 2007 01:47:53 +0200 |
parents | |
children | 8d45266bbabe |
comparison
equal
deleted
inserted
replaced
17:6c6cd097bcdf | 18:c05ef76f1c20 |
---|---|
1 module std.stdio; | |
2 | |
3 void _writef(T)(T t) { | |
4 //static if(is(T: Object)) _writef(t.toString()); else | |
5 static if(is(T: char[])) printf("%.*s", t.length, t.ptr); else | |
6 static if(is(T==int)) printf("%i", t); else | |
7 static assert(false, "Cannot print "~T.stringof); | |
8 } | |
9 | |
10 void writef(T...)(T t) { | |
11 foreach (v; t) _writef(v); | |
12 } | |
13 void writefln(T...)(T t) { | |
14 writef(t, "\n"[]); | |
15 } |