libmir / mir

Mir (backports): Sparse tensors, Hoffman
http://mir.libmir.org
Boost Software License 1.0
210 stars 20 forks source link

can't understand how `sliced` definition compiles #399

Closed timotheecour closed 5 years ago

timotheecour commented 5 years ago

@9il I don't understand how to parse this:

in mir-algorithm/source/mir/ndslice/slice.d

Slice!(Iterator, N, kind)
    sliced
    (Iterator, size_t N, SliceKind kind)
    (Slice!(Iterator, 1, kind) slice, size_t[N] lengths...)
    if (N)
{ ... }

it looks like: ReturnType sliced(args) (something_else) if(N) {...}

what is (something_else) ?

dnadlinger commented 5 years ago

(args) are the template parameters, (something_else) the actual parameters.

9il commented 5 years ago

sliced has multiple declarations (edited). This definition construct an ND slice from 1-dimensional slice and shape lengths

timotheecour commented 5 years ago

sorry idk why i was confused