mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-04-18 01:39:03 +02:00
[svn r25] * Fixed a lot of problems with string literals
* Fixed slice-slice copying assignment
This commit is contained in:
@@ -1,8 +1,15 @@
|
||||
module std.stdio;
|
||||
|
||||
void _writef(T)(T t) {
|
||||
//static if(is(T: Object)) _writef(t.toString()); else
|
||||
static if(is(T: Object)) _writef(t.toString()); else
|
||||
static if(is(T==char)) _writef("%c", t); else
|
||||
static if(is(T: char[])) printf("%.*s", t.length, t.ptr); else
|
||||
static if(isArray!(T)) {
|
||||
_writef('[');
|
||||
if (t.length) _writef(t[0]);
|
||||
for (int i=1; i<elem.length; ++i) { _writef(','); _writef(t[i]); }
|
||||
_writef(']');
|
||||
} else
|
||||
static if(is(T==int)) printf("%i", t); else
|
||||
static assert(false, "Cannot print "~T.stringof);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user