DIP Mir1 Draft: Variadic template parameters with the same time.

ag0aep6g via Digitalmars-d digitalmars-d at puremagic.com
Thu Sep 29 13:57:00 PDT 2016


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 ...) { /* ... */ }


More information about the Digitalmars-d mailing list