Range

This stucts represents a range with a beginning and an end. The Range only workds with integer types and char types.

Members

Functions

length
size_t length()

Returns the number of elements in the Range

opApply
int opApply(int delegate(ref T) dg)

Allows the range to work in a foreach loop

opApplyReverse
int opApplyReverse(int delegate(ref T) dg)

Allows the range to work in a foreach_reverse loop

opCall
T[] opCall()

Creates an array of the Range

opIndex
T opIndex(T index)

Returns the element at the specified index

opSlice
T[] opSlice()

Creates an array of the Range

toArr
T[] toArr()

Creates an array of the Range

Static functions

opSlice
Range!(T, U) opSlice(T start, U end)

Creates a new Range using the following syntax

Variables

end
U end;

The end of the range

start
T start;

The beginning of the range

Examples

auto r = range[3..9];

foreach (i ; r)
	println(i);

// will print 3 up to including 8

foreach (c ; range['a'..'h'];
	println(c);

// will print a up to including g

Meta