The OpenD Programming Language

mir_slice.idup

Duplicates slice.

  1. Slice!(immutable(DeepElement)*, N) idup()
    struct mir_slice(Iterator_, size_t N_ = 1, SliceKind kind_ = Contiguous, Labels_...)
    scope @property
    Slice!(immutable(DeepElement)*, N)
    idup
    ()
    ()
    if (
    0 < N_ &&
    N_ < 255
    &&
    !(
    kind_ == Canonical &&
    N_ == 1
    )
    &&
    Labels_.length <= N_
    &&
    isIterator!Iterator_
    )
  2. Slice!(immutable(DeepElement)*, N) idup()
  3. Slice!(immutable(DeepElement)*, N) idup()

Return Value

Type: Slice!(immutable(DeepElement)*, N)

GC-allocated Contiguous immutable slice.

Examples

import mir.ndslice;
auto x = 3.iota!int;
Slice!(int*) mut = x.dup;
Slice!(immutable(int)*) imm = mut.idup;
assert(imm == x);
assert(mut == x);

See Also

Meta