@@ -155,7 +155,7 @@ void print(...)
155
155
156
156
$(P It isn't elegant or the most efficient,
157
157
but it does work. However it is not the recommended way to write variadic functions.
158
- (It relies on the parameters _argptr and _arguments imported from core.vararg
158
+ (It relies on the parameters ` _argptr` and ` _arguments` imported from ` core.vararg`
159
159
which give a pointer to the values and their types, respectively.)
160
160
)
161
161
@@ -180,18 +180,19 @@ void print(T, A...)(T t, A a)
180
180
$(P There are two function templates. The first provides the
181
181
degenerate case of no arguments, and a terminus for the
182
182
recursion of the second. The second has two arguments:
183
- t for the first value and a for the rest of the values.
184
- A... says the parameter is a tuple, and implicit function
185
- template instantiation will fill in A with the list of
186
- all the types following t. So, print(7, 'a', 6.8) will
187
- fill in int for T, and a tuple (char, double) for A.
188
- The parameter a becomes an expression tuple of the arguments.
183
+ `t` for the first value and `a` for any remaining values.
184
+ `A...` says the parameter is a sequence, and $(I implicit function
185
+ template instantiation) will fill in `A` with all the types of any
186
+ arguments supplied following `t`. So, `print(7, 'a', 6.8)` will
187
+ fill in `int` for `T`, and a type sequence `(char, double)` for `A`.
188
+ The parameter `a` is an lvalue sequence of any
189
+ arguments supplied after `t`.
189
190
)
190
191
191
- $(P The function works by printing the first parameter t ,
192
+ $(P The function works by printing the first parameter `t` ,
192
193
and then recursively calling itself with the remaining arguments
193
- a . The recursion terminates when there are no longer any
194
- arguments by calling print()().
194
+ `a` . The recursion terminates when there are no longer any
195
+ arguments by calling ` print()()` .
195
196
)
196
197
197
198
$(H4 The Static If Solution)
@@ -213,18 +214,18 @@ void print(A...)(A a)
213
214
}
214
215
---
215
216
216
- $(P Tuples can be manipulated much like arrays.
217
- So a.length resolves to the number of expressions
218
- in the tuple a. a[0] gives the first expression
219
- in the tuple. a[1 .. $] creates a new tuple
220
- by slicing the original tuple .
217
+ $(P Sequences can be manipulated much like arrays.
218
+ So ` a.length` resolves to the number of elements
219
+ in the sequence `a`. ` a[0]` gives the first element
220
+ in the sequence. ` a[1 .. $]` creates a new sequence
221
+ from any remaining elements in the original sequence .
221
222
)
222
223
223
224
$(H4 The Foreach Solution)
224
225
225
- $(P But since tuples can be manipulated like arrays,
226
- we can use a foreach statement to 'loop' over
227
- the tuple 's expressions :
226
+ $(P But since sequences can be manipulated like arrays,
227
+ we can use a ` foreach` statement to iterate over
228
+ the sequence 's elements :
228
229
)
229
230
230
231
---
0 commit comments