digitalmars.D - Locally Instantiated Templates
- Ellery Newcomer (12/12) Oct 25 2009 Walter alluded to these a while back in one of his Dr Dobbs articles
- Kagamin (2/5) Oct 26 2009 templates have no storage. Template is just a semantical construct for p...
Walter alluded to these a while back in one of his Dr Dobbs articles (nested functions, part 2), and this evening I've been playing with them a little. It doesn't look like they be mentioned anywhere in the spec. How do they work? It looks kinda like you would just replace any nonlocal symbol 'a' with '.a' and then do the local instantiation part. Or maybe not. Does local instantiation just mean the template instance is located in the stack (heap?) frame, and otherwise is conceptually the same as any other template instance? e.g. same scoping rules? Also, the compiler seems to disallow them for non-global templates. How does that tie in with the rest of it?
Oct 25 2009
Ellery Newcomer Wrote:Does local instantiation just mean the template instance is located in the stack (heap?) frame, and otherwise is conceptually the same as any other template instance? e.g. same scoping rules?templates have no storage. Template is just a semantical construct for parameterizing types. Template members (variables, functions, types) may have storage.
Oct 26 2009