Permalink
Browse files

Fixes Issue 8619 - Tuple article should use writeln to properly print.

  • Loading branch information...
1 parent 7c316bb commit 1bc66cdee2a05abd3a4b7c81d3b24e96805fdb35 @AndrejMitrovic AndrejMitrovic committed Feb 7, 2013
Showing with 12 additions and 12 deletions.
  1. +12 −12 tuple.dd
View
24 tuple.dd
@@ -150,8 +150,8 @@ int foo(int x, long y);
void Bar(R, P...)(R function(P))
{
- writefln("return type is ", typeid(R));
- writefln("parameter types are ", typeid(P));
+ writeln("return type is ", typeid(R));
+ writeln("parameter types are ", typeid(P));
}
...
@@ -171,7 +171,7 @@ parameter types are (int,long)
---
void Abc(P...)(P p)
{
- writefln("parameter types are ", typeid(P));
+ writeln("parameter types are ", typeid(P));
}
Abc(3, 7L, 6.8);
@@ -199,9 +199,9 @@ $(H3 Expression Tuples)
alias Tuple!(3, 7L, 6.8) ET;
...
-writefln(ET); // prints 376.8
-writefln(ET[1]); // prints 7
-writefln(ET[1..length]); // prints 76.8
+writeln(ET); // prints 376.8
+writeln(ET[1]); // prints 7
+writeln(ET[1..length]); // prints 76.8
---
$(P It can be used to create an array literal:)
@@ -222,7 +222,7 @@ struct S { int x; long y; }
void foo(int a, long b)
{
- writefln(a, b);
+ writeln(a, b);
}
...
@@ -241,7 +241,7 @@ s.tupleof[2] = 11; // error, no third field of S
of a struct using $(B typeof):)
---
-writefln(typeid(typeof(S.tupleof))); // prints (int,long)
+writeln(typeid(typeof(S.tupleof))); // prints (int,long)
---
$(P This is encapsulated in the template
@@ -259,11 +259,11 @@ $(H3 Looping)
---
alias Tuple!(int, long, float) TL;
foreach (i, T; TL)
- writefln("TL[%d] = ", i, typeid(T));
+ writefln("TL[%d] = %s", i, typeid(T));
alias Tuple!(3, 7L, 6.8) ET;
foreach (i, E; ET)
- writefln("ET[%d] = ", i, E);
+ writefln("ET[%d] = %s", i, E);
---
$(P Prints:)
@@ -287,7 +287,7 @@ alias Tuple!(int, long) TL;
void foo(TL tl)
{
- writefln(tl, tl[1]);
+ writeln(tl, tl[1]);
}
foo(1, 6L); // prints 166
@@ -368,7 +368,7 @@ void main()
$(P The reason for the $(I Dummy) parameter is that one
cannot overload two templates with the same parameter list.
- So we make them different by giving one a dummy parameter.
+ So we make them different by giving one a dummy parameter.
)
$(H3 Future Directions)

0 comments on commit 1bc66cd

Please sign in to comment.