Function Vector.opSlice

Returns a slice [begin .. end]. If the requested slice extends past the end of the vector, the returned slice is invalid.

inout inout(Vector.ElementType)[] opSlice(bool check = true) (
  const size_t begin,
  const size_t end
) pure nothrow @nogc @system;

The slice returned may be invalidated by further calls to other member functions that modify the object.

Examples

Vector!(int, 6) vec = Vector!(int, 6).build(1, 2, 3, 4, 5, 6);

assert(vec[1 .. 4] == [2, 3, 4]);
assert(vec[1 .. $] == [2, 3, 4, 5, 6]);