Typesafe variadic functions requiring at least one argument
pineapple via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jul 7 07:32:24 PDT 2016
On Thursday, 7 July 2016 at 03:52:40 UTC, Jonathan M Davis wrote:
> However, it looks like you can combine those two types of
> variadic functions to get more or less what you want (albeit
> more verbosely). e.g.
>
> template isInt(T) { enum isInt = is(std.traits.Unqual!T ==
> int); }
>
> void test(Args...)(Args args)
> if(args.length > 0 && std.meta.allSatisfy!(isInt, Args))
> {
> test2(args);
> }
Exactly what I was looking for. Thanks!
More information about the Digitalmars-d-learn
mailing list