small fixes

This commit is contained in:
Johannes Loher 2018-06-18 14:56:18 +02:00
parent d76e6b0b76
commit ed70225208

View file

@ -674,7 +674,7 @@ if (a == 5) {
#### switch…case #### switch…case
Also very similar to how it is defined in other languages, but for it works for 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 ```D
string myString; string myString;
@ -902,7 +902,7 @@ If a member function of a base class if overwritten, the `override` keyword must
be used: be used:
```D ```D
class Bar: Foo { class Bar : Foo {
override void functionFromFoo() {} override void functionFromFoo() {}
} }
``` ```
@ -1005,7 +1005,7 @@ struct S(T) {
/* … */ /* … */
} }
auto s = S!int; auto s = S!int();
``` ```
It is also possible to have variable templates: It is also possible to have variable templates:
@ -1013,7 +1013,7 @@ It is also possible to have variable templates:
```D ```D
ubyte[T.sizeof * 8] buffer8(T) = 42; 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])); static assert(is(typeof(myBuffer) == ubyte[32]));
assert(myBuffer[0] == 42); assert(myBuffer[0] == 42);
``` ```
@ -1028,7 +1028,7 @@ template buffer8(T) {
#### Template value parameters #### 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: template value parameters:
```D ```D