digitalmars.D.bugs - . is still required for recursion when a template alias is used.
- Don Clugston (14/14) Jan 25 2006 If you insert a dot before the recursive factorial call,
- Thomas Kuehne (12/26) Feb 05 2006 -----BEGIN PGP SIGNED MESSAGE-----
If you insert a dot before the recursive factorial call, it will work correctly. ----------- template factorial(int n) { static if (n<2) const int factorial = 1; else const int factorial = n * factorial!(n-1); } template rhino(alias hippo) { const int rhino = hippo!(2); } const int lion = rhino!(factorial); --------------
Jan 25 2006
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Don Clugston schrieb am 2006-01-25:If you insert a dot before the recursive factorial call, it will work correctly. ----------- template factorial(int n) { static if (n<2) const int factorial = 1; else const int factorial = n * factorial!(n-1); } template rhino(alias hippo) { const int rhino = hippo!(2); } const int lion = rhino!(factorial); --------------Added to DStress as http://dstress.kuehne.cn/run/t/template_26_A.d http://dstress.kuehne.cn/run/t/template_26_B.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFD5bZO3w+/yD4P9tIRAuTmAJ4/CgyPtPApqw119oJwJTYaRwJS0gCgrqB0 jrijOw1cOV9NAsuv9ZdIBsY= =RCJP -----END PGP SIGNATURE-----
Feb 05 2006