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

Ilya Yaroshenko via Digitalmars-d digitalmars-d at puremagic.com
Thu Sep 29 13:43:40 PDT 2016


On Thursday, 29 September 2016 at 20:12:44 UTC, Walter Bright 
wrote:
> Here's one way to do it:
> ------
> import core.stdc.stdio;
>
> void foo(T)(T[] a ...)
> {
>     printf("%d %d %d\n", a[0], a[1], a[2]);
> }
>
> void main()
> {
>     foo(1, 2, 3);
> }
> -----
> C:\cbx>foo
> 1 2 3

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


More information about the Digitalmars-d mailing list