Q: What are the rules for emitting template code?
Simen kjaeraas
simen.kjaras at gmail.com
Sun Oct 24 02:16:12 PDT 2010
Austin Hastings <ah08010-d at yahoo.com> wrote:
> If Decider uses Option1.sizeof, does any Option1 code get emitted?
For sizeof to be known, the template would have to be instantiated, yes.
> If Decider uses some external function that makes use of type aliases in
> Option1, (example: Option1() { alias byte value_t; } ) does any Option1
> code get emitted?
Again, the same.
> If Decider uses some function defined inside the same module with
> Option1, but NOT inside of Option1, does any/all of the Option1 code get
> emitted?
Accessing the surrounding scope would not instantiate Option1. So no.
> If Decider uses a static method of Option1, does any more of the Option1
> code get emitted?
As with the first two, it would have to be instantiated.
Now, I have the feeling this is not really what you're asking for. What
do you mean by 'code gets emitted'? Perhaps you could give a reduced
example?
--
Simen
More information about the Digitalmars-d
mailing list