NestedTemplateAndArgsOf

Decomposes the chain of the templates and arguments used to create the alias passed as argument.

  1. template NestedTemplateAndArgsOf(alias T, TemplateAndArgsOf...)
    template NestedTemplateAndArgsOf (
    TemplateAndArgsOf...
    ) {}
  2. template NestedTemplateAndArgsOf(T)

Parameters

T

An alias.

TemplateAndArgsOf

used internally only.

Return Value

An AliasSeq formed by a chain of templates and arguments.

Examples

1 template A(As...)
2 {
3     template B(Bs...){int a;}
4 }
5 alias AB0 = A!(1,2).B!(3,4,5);
6 alias SQ0 = NestedTemplateAndArgsOf!AB0;
7 static assert(__traits(isSame, SQ0[0], A));
8 static assert(__traits(isSame, SQ0[1], 1));
9 static assert(__traits(isSame, SQ0[2], 2));
10 static assert(__traits(isSame, SQ0[3], A!(1,2).B));
11 static assert(__traits(isSame, SQ0[4], 3));
12 static assert(__traits(isSame, SQ0[5], 4));
13 static assert(__traits(isSame, SQ0[6], 5));
14 
15 template C(T)
16 {
17     template D(T)
18     {
19         template E(T) {}
20     }
21 }
22 alias CDE0 = C!int.D!int.E!int;
23 alias SQ1 = NestedTemplateAndArgsOf!CDE0;
24 static assert(__traits(isSame, SQ1[0], C));
25 static assert(is(SQ1[1] == int));
26 static assert(__traits(isSame, SQ1[2], C!int.D));
27 static assert(is(SQ1[3] == int));
28 static assert(__traits(isSame, SQ1[4], C!int.D!int.E));
29 static assert(is(SQ1[5] == int));
30 
31 alias B = NestedTemplateAndArgsOf!int;
32 static assert(is(B == void));
33 
34 template G(Gs...)
35 {
36     struct G {}
37 }
38 
39 alias GI = G!int;
40 
41 //pragma(msg, NestedTemplateAndArgsOf!(G!int).stringof);

Meta