argumentInfo

This template return arity of a function.

template argumentInfo (
alias templateFun
alias ParamGenRange
) if (
isTemplateRange!ParamGenRange &&
!ParamGenRange.empty
) {
enum size_t arity;
}

Examples

1 template Generator0(size_t N)
2 {
3     alias TypeNuple!(int, N) Generator0;
4 }
5 
6 alias argumentInfo!(( (a, b, c) => a), Generator0) Result0;
7 
8 static assert(Result0.arity == 3);
9 static assert(Result0.endN == 3);
10 static assert(is(Result0.ParameterTypeTuple == Generator0!3));
11 static assert(is(Result0.ReturnType == int));
12 
13 
14 template Generator1(size_t N)
15 {
16     alias TypeTuple!(int, ushort, long, double*, uint, real[])[N] Generator1;
17 }
18 
19 static assert(Result1.arity == 1);
20 static assert(Result1.endN == 3);
21 static assert(is(Result1.ParameterTypeTuple == double*));
22 static assert(is(Result1.ReturnType == double*));

Meta

Authors

Kazuki Komatsu(k3_kaimu)