Typesafe variadic functions requiring at least one argument

kinke via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jul 6 13:18:29 PDT 2016


In case you want a compile error if no arguments are specified, 
you can use something like this:

void foo()() { static assert(0); }
void foo(int[] ints...) { assert(ints); }

void main()
{
     foo(1, 2, 3);
     foo();
}


More information about the Digitalmars-d-learn mailing list