March 2014 update
This commit is contained in:
parent
09687c4926
commit
a25938f123
1846 changed files with 21876 additions and 5203 deletions
|
|
@ -2,22 +2,22 @@ import std.stdio, std.algorithm;
|
|||
|
||||
void printAll(TyArgs...)(TyArgs args) {
|
||||
foreach (el; args)
|
||||
writeln(el);
|
||||
el.writeln;
|
||||
}
|
||||
|
||||
// Typesafe variadic function for dynamic array
|
||||
void showSum1(int[] items...) {
|
||||
writeln(reduce!q{a + b}(0, items));
|
||||
items.sum.writeln;
|
||||
}
|
||||
|
||||
// Typesafe variadic function for fixed size array
|
||||
void showSum2(int[4] items...) {
|
||||
writeln(reduce!q{a + b}(0, items));
|
||||
items[].sum.writeln;
|
||||
}
|
||||
|
||||
void main() {
|
||||
printAll(4, 5.6, "Rosetta", "Code", "is", "awesome");
|
||||
writeln();
|
||||
printAll(4, 5.6, "Rosetta", "Code", "is", "awseome");
|
||||
writeln;
|
||||
showSum1(1, 3, 50);
|
||||
showSum2(1, 3, 50, 10);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue