Hendrik Schober
10/1/2008 9:56:00 PM
nooneinparticular314159@yahoo.com wrote:
> Thanks! So to see if I understand this correctly, the line:
> enum {RESULT = i * FACTOR<I-1>::RESULT};
>
> means that I am going to perform a computation where I multiply the
> result of evaluating the class FACTOR on the value I-1, and I'm going
> to store that result in RESULT, which the compiler stores somewhere as
> a constant. Then with the RESULT after the ::, I'm directing the
> compiler to look up the value contained in RESULT, and that is the
> value that is actually being returned from the evaluation of the
> entire line. Is that correct?
AFAIU, no.
I have added some parentheses:
enum { RESULT = i * (FACTOR<I-1>::RESULT) };
The 'FACTOR<I-1>::RESULT' is a compile-time constant
of (I-1)! which is used to calculate the compile-time
constant 'RESULT'.
Does this help?
> Thanks!
Schobi