unzip

Selects a slice from a zipped slice.

  1. auto unzip(Slice!(ZipIterator!Iterators, N, kind) slice)
    @optmath
    unzip
    (
    char name
    size_t N
    SliceKind kind
    Iterators...
    )
    (
    Slice!(ZipIterator!Iterators, N, kind) slice
    )
  2. auto unzip(Slice!(ZipIterator!Iterators, N, kind) slice)

Parameters

name

name of a slice to unzip.

slice Slice!(ZipIterator!Iterators, N, kind)

zipped slice

Return Value

Type: auto

unzipped slice

Examples

import mir.ndslice.allocation : slice;
import mir.ndslice.topology : iota;

auto alpha = iota!int(4, 3);
auto beta = iota!int([4, 3], 1).slice;

auto m = zip(alpha, beta);

static assert(is(typeof(unzip!'a'(m)) == typeof(alpha)));
static assert(is(typeof(unzip!'b'(m)) == typeof(beta)));

assert(m.unzip!'a' == alpha);
assert(m.unzip!'b' == beta);

Meta