@@ -158,33 +158,37 @@ $(H3 Translating the Variadic C++ Solution into D)
158
158
)
159
159
160
160
---
161
- void print()()
161
+ void print()
162
162
{
163
163
}
164
164
165
165
void print(T, A...)(T t, A a)
166
166
{
167
+ import std.stdio;
167
168
writeln(t);
168
169
print(a);
169
170
}
170
171
---
171
172
172
- $(P There are two function templates . The first provides the
173
+ $(P There are two overloads . The first provides the
173
174
degenerate case of no arguments, and a terminus for the
174
175
recursion of the second. The second has two arguments:
175
176
`t` for the first value and `a` for any remaining values.
176
- `A...` says the parameter is a sequence, and $(I implicit function
177
- template instantiation) will fill in `A` with all the types of any
177
+ `A...` says the parameter is a sequence, and
178
+ $(GLOSSARY2 ifti, Implicit Function Template Instantiation)
179
+ will fill in `A` with all the types of any
178
180
arguments supplied following `t`. So, `print(7, 'a', 6.8)` will
179
181
fill in `int` for `T`, and a type sequence `(char, double)` for `A`.
180
182
The parameter `a` is an lvalue sequence of any
181
- arguments supplied after `t`.
183
+ arguments supplied after `t`. See
184
+ $(DDLINK articles/ctarguments, Compile-time Sequences, Compile-time Sequences)
185
+ for more information.
182
186
)
183
187
184
188
$(P The function works by printing the first parameter `t`,
185
189
and then recursively calling itself with the remaining arguments
186
190
`a`. The recursion terminates when there are no longer any
187
- arguments by calling `print()() `.
191
+ arguments by calling `print()`.
188
192
)
189
193
190
194
$(H3 The Static If Solution)
0 commit comments