Tutorial by Examples

import std.stdio; T min(T)(in T arg1, in T arg2) { return arg1 < arg2 ? arg1 : arg2; } void main() { //Automatic type inference writeln(min(1, 2)); //Explicit type writeln(min!(ubyte)(1, 2)); //With single type, the parenthesis might be ommited ...
An template can be introduced with template. It can contain functions and classes and other constructs. template StaticArray(Type, size_t Length) { class StaticArray { Type content[Length]; size_t myLength() { return getLength(this); }...

Page 1 of 1