Questions tagged [d-templates]

Templates are D's approach to generic programming. Use this tag for questions where the declaration or instantiation of templates is relevant to the problem. Do not use this tag if D code simply instantiates a template but where that usage isn't relevant to the problem or question.

Templates are 's approach to generic programming.

What questions should have this tag?

Use this tag for questions where the declaration or instantiation of templates is relevant to the problem.

When to avoid this tag

Do not use this tag if D code simply instantiates a template but where that usage isn't relevant to the problem or question.

1 questions
2
votes
1 answer

Cannot use local 'i' as parameter to non-global template

template IsSame(T){ template As(alias t){ enum As = is(T : typeof(t)); } } void main() { int i; enum b = IsSame!int.As!(i); } Err: Error: template instance As!(i) cannot use local 'i' as parameter to non-global template As(alias t)…
Maik Klein
  • 15,548
  • 27
  • 101
  • 197