Re: Q: What are the rules for emitting template code?

2010-10-25 Thread Fawzi Mohamed
On 25-ott-10, at 18:04, Steven Schveighoffer wrote: On Sun, 24 Oct 2010 00:06:23 -0400, Austin Hastings > wrote: Howdy, This is a bit involved, so bear with me. Suppose I have a template, Decider(Args...) and some other templates, Option1(...), Option2(...), etc. The job of Decider() is

Re: Q: What are the rules for emitting template code?

2010-10-25 Thread Jonathan M Davis
On Monday, October 25, 2010 06:08:24 Austin Hastings wrote: > On 10/24/2010 5:16 AM, Simen kjaeraas wrote: > > Austin Hastings 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. > > Insta

Re: Q: What are the rules for emitting template code?

2010-10-25 Thread Steven Schveighoffer
On Sun, 24 Oct 2010 00:06:23 -0400, Austin Hastings wrote: Howdy, This is a bit involved, so bear with me. Suppose I have a template, Decider(Args...) and some other templates, Option1(...), Option2(...), etc. The job of Decider() is to decide, based on the given parameters, which of

Re: Q: What are the rules for emitting template code?

2010-10-25 Thread Austin Hastings
On 10/24/2010 5:16 AM, Simen kjaeraas wrote: Austin Hastings 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. Instantiated does not necessarily imply emitting code, I think. (Of course, this

Re: Q: What are the rules for emitting template code?

2010-10-24 Thread Simen kjaeraas
Austin Hastings 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; }

Q: What are the rules for emitting template code?

2010-10-23 Thread Austin Hastings
Howdy, This is a bit involved, so bear with me. Suppose I have a template, Decider(Args...) and some other templates, Option1(...), Option2(...), etc. The job of Decider() is to decide, based on the given parameters, which of the possible OptionN templates to use. Decider uses "static if"