On Thursday, 29 September 2016 at 20:57:00 UTC, ag0aep6g wrote:
On 09/29/2016 10:43 PM, Ilya Yaroshenko wrote:
On Thursday, 29 September 2016 at 20:12:44 UTC, Walter Bright wrote:
[...]
void foo(T)(T[] a ...)
{
    printf("%d %d %d\n", a[0], a[1], a[2]);
}
[...]

a.length must be known at CT. 99%-100% foreach loops in ndslice package
are CT.

I'm not sure if I understand the goal, but what about this:

void foo(size_t n)(size_t[n] a ...) { /* ... */ }

Just found an example, where this approach does not work :-(

template transposed(Dimensions...)
    if (Dimensions.length)
{
Slice!(N, Range) transposed(size_t N, Range)(auto ref Slice!(N, Range) slice)
    {
        ...
    }
}

Reply via email to