arity

Returns the number of arguments of function func. arity is undefined for variadic functions.

template arity (
alias func
) if (
isCallable!func &&
variadicFunctionStyle!func == Variadic.no
) {
enum size_t arity;
}

Examples

void foo(){}
static assert(arity!foo == 0);
void bar(uint){}
static assert(arity!bar == 1);
void variadicFoo(uint...){}
static assert(!__traits(compiles, arity!variadicFoo));

Meta