Array.opSlice

Return a slice to the current array that is bounded by start and end. start must be less than or equal to end and end must be less than or equal to length.

  1. Qualified opSlice()
  2. Qualified opSlice(size_t start, size_t end)
    struct Array(T)
    Qualified
    opSlice
    (
    this Qualified
    )
    (
    size_t start
    ,
    size_t end
    )

Parameters

start size_t

a positive integer

end size_t

a positive integer

Complexity: O(1)

Return Value

Type: Qualified

an array that references the current array.

Examples

import std.algorithm.comparison : equal;

auto stuff = [1, 2, 3];
auto a = Array!int(stuff);
assert(equal(a[], stuff));
assert(equal(a[1 .. $], stuff[1 .. $]));

Meta