mir_slice.dup

Duplicates slice.

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

Return Value

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

GC-allocated Contiguous mutable slice.

Examples

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

See Also

Meta