digitalmars.D.learn - Alias parameters in nested templates
- =?iso-8859-2?B?VG9tZWsgU293afFza2k=?= (17/17) Feb 11 2010 I've been playing with templates recently and there's something I don't ...
I've been playing with templates recently and there's something I don't quite get. template Outer() { template Inner(alias param) { alias param Inner; } } void main() { long d; Outer!().Inner!(d) = 4; // fails } Error: template instance cannot use local 'd' as parameter to non-global template Inner(alias param) Why is it OK to pass aliases to local variables to a normal (global) template, and not OK to a nested one? I'd appreciate a counter-example of sth bad happening in the forbidden case. Tomek
Feb 11 2010