mir_slice.first

Accesses the first deep element of the slice.

  1. auto ref first()
  2. auto ref first(T value)
    struct mir_slice(Iterator_, size_t N_ = 1, SliceKind kind_ = Contiguous, Labels_...)
    ref scope return @trusted @property
    @optmath
    static if(N > 1)
    static if(isMutable!DeepElement && !hasAccessByRef)
    first
    (
    T
    )
    ()
    if (
    0 < N_ &&
    N_ < 255
    &&
    !(
    kind_ == Canonical &&
    N_ == 1
    )
    &&
    Labels_.length <= N_
    &&
    isIterator!Iterator_
    )
  3. alias first = front

Examples

import mir.ndslice.topology: iota, universal, canonical;
auto f = 5;
assert([2, 3].iota(f).first == f);

Meta