Mercurial > projects > ldc
comparison lphobos/std/stdio.d @ 37:77cdca8c210f trunk
[svn r41] new'd dynamic arrays are now initialized with the element type's default initializer.
initial label/goto support.
author | lindquist |
---|---|
date | Wed, 10 Oct 2007 03:38:24 +0200 |
parents | 77e3d1ddae3f |
children | 2c3cd3596187 |
comparison
equal
deleted
inserted
replaced
36:c0967c4b2a74 | 37:77cdca8c210f |
---|---|
10 _writef('['); | 10 _writef('['); |
11 if (t.length) _writef(t[0]); | 11 if (t.length) _writef(t[0]); |
12 for (int i=1; i<t.length; ++i) { _writef(','); _writef(t[i]); } | 12 for (int i=1; i<t.length; ++i) { _writef(','); _writef(t[i]); } |
13 _writef(']'); | 13 _writef(']'); |
14 } else | 14 } else |
15 static if(is(T==int)) printf("%i", t); else | 15 static if(is(T: int)) printf("%i", t); else |
16 static if(is(T: real)) printf("%f", t); else | |
16 static assert(false, "Cannot print "~T.stringof); | 17 static assert(false, "Cannot print "~T.stringof); |
17 } | 18 } |
18 | 19 |
19 void writef(T...)(T t) { | 20 void writef(T...)(T t) { |
20 foreach (v; t) _writef(v); | 21 foreach (v; t) _writef(v); |
21 } | 22 } |
22 void writefln(T...)(T t) { | 23 void writefln(T...)(T t) { |
23 writef(t, "\n"[]); | 24 writef(t, "\n"); |
24 } | 25 } |
26 |