small fixes
This commit is contained in:
parent
d76e6b0b76
commit
ed70225208
1 changed files with 5 additions and 5 deletions
|
@ -674,7 +674,7 @@ if (a == 5) {
|
|||
#### switch…case
|
||||
|
||||
Also very similar to how it is defined in other languages, but for it works for
|
||||
integer types, bools and strings (which will be covered later).
|
||||
integer types, bools and strings.
|
||||
|
||||
```D
|
||||
string myString;
|
||||
|
@ -1005,7 +1005,7 @@ struct S(T) {
|
|||
/* … */
|
||||
}
|
||||
|
||||
auto s = S!int;
|
||||
auto s = S!int();
|
||||
```
|
||||
|
||||
It is also possible to have variable templates:
|
||||
|
@ -1013,7 +1013,7 @@ It is also possible to have variable templates:
|
|||
```D
|
||||
ubyte[T.sizeof * 8] buffer8(T) = 42;
|
||||
|
||||
auto myBuffer = buffer!(int, 8); // create a buffer with space for 8 ints and initialize its elements to 42
|
||||
auto myBuffer = buffer!(int); // create a buffer with space for 8 ints and initialize its elements to 42
|
||||
static assert(is(typeof(myBuffer) == ubyte[32]));
|
||||
assert(myBuffer[0] == 42);
|
||||
```
|
||||
|
@ -1028,7 +1028,7 @@ template buffer8(T) {
|
|||
|
||||
#### Template value parameters
|
||||
|
||||
So far we have only seen templateF type parameters. It is also possible to have
|
||||
So far we have only seen template type parameters. It is also possible to have
|
||||
template value parameters:
|
||||
|
||||
```D
|
||||
|
|
Loading…
Reference in a new issue