annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18
c05ef76f1c20 [svn r22] * Forgot to add std.stdio
lindquist
parents:
diff changeset
1 module std.stdio;
c05ef76f1c20 [svn r22] * Forgot to add std.stdio
lindquist
parents:
diff changeset
2
c05ef76f1c20 [svn r22] * Forgot to add std.stdio
lindquist
parents:
diff changeset
3 void _writef(T)(T t) {
c05ef76f1c20 [svn r22] * Forgot to add std.stdio
lindquist
parents:
diff changeset
4 //static if(is(T: Object)) _writef(t.toString()); else
c05ef76f1c20 [svn r22] * Forgot to add std.stdio
lindquist
parents:
diff changeset
5 static if(is(T: char[])) printf("%.*s", t.length, t.ptr); else
c05ef76f1c20 [svn r22] * Forgot to add std.stdio
lindquist
parents:
diff changeset
6 static if(is(T==int)) printf("%i", t); else
c05ef76f1c20 [svn r22] * Forgot to add std.stdio
lindquist
parents:
diff changeset
7 static assert(false, "Cannot print "~T.stringof);
c05ef76f1c20 [svn r22] * Forgot to add std.stdio
lindquist
parents:
diff changeset
8 }
c05ef76f1c20 [svn r22] * Forgot to add std.stdio
lindquist
parents:
diff changeset
9
c05ef76f1c20 [svn r22] * Forgot to add std.stdio
lindquist
parents:
diff changeset
10 void writef(T...)(T t) {
c05ef76f1c20 [svn r22] * Forgot to add std.stdio
lindquist
parents:
diff changeset
11 foreach (v; t) _writef(v);
c05ef76f1c20 [svn r22] * Forgot to add std.stdio
lindquist
parents:
diff changeset
12 }
c05ef76f1c20 [svn r22] * Forgot to add std.stdio
lindquist
parents:
diff changeset
13 void writefln(T...)(T t) {
c05ef76f1c20 [svn r22] * Forgot to add std.stdio
lindquist
parents:
diff changeset
14 writef(t, "\n"[]);
c05ef76f1c20 [svn r22] * Forgot to add std.stdio
lindquist
parents:
diff changeset
15 }