Locally Instantiated Templates

Ellery Newcomer ellery-newcomer at utulsa.edu
Sun Oct 25 21:50:21 PDT 2009


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?



More information about the Digitalmars-d mailing list