mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-07-22 07:05:22 +02:00
[svn r22] * Forgot to add std.stdio
This commit is contained in:
15
lphobos/std/stdio.d
Normal file
15
lphobos/std/stdio.d
Normal file
@@ -0,0 +1,15 @@
|
||||
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"[]);
|
||||
}
|
||||
Reference in New Issue
Block a user