The OpenD Programming Language

mir_slice.field

Field (array) data.

  1. auto field()
    struct mir_slice(Iterator_, size_t N_ = 1, SliceKind kind_ = Contiguous, Labels_...)
    return scope @trusted @property
    field
    ()
    ()
    if (
    0 < N_ &&
    N_ < 255
    &&
    !(
    kind_ == Canonical &&
    N_ == 1
    )
    &&
    Labels_.length <= N_
    &&
    isIterator!Iterator_
    )
  2. auto field()
  3. auto field()

Return Value

Type: auto

Raw data slice. Constraints: Field is defined only for contiguous slices.

Examples

auto arr = [1, 2, 3, 4];
auto sl0 = arr.sliced;
auto sl1 = arr.slicedField;

assert(sl0.field is arr);
assert(sl1.field is arr);

arr = arr[1 .. $];
sl0 = sl0[1 .. $];
sl1 = sl1[1 .. $];

assert(sl0.field is arr);
assert(sl1.field is arr);
assert((cast(const)sl1).field is arr);
()@trusted{ assert((cast(immutable)sl1).field is arr); }();

Meta