
22 Jan
2007
22 Jan
'07
10:59 p.m.
On 1/22/07, Sami
Hi All,
This is a newbie mpl question, and here goes:
How can evaluate integer powers using mpl? Such as,
template < unsigned Pow, class Real > Real pow( Real r ) { return
; // the expression is compile time, // not the result of course.
if (Pow == 0) return 1; // to do argue about the value of '0 to the 0'.
if (Pow == 1) return r;
return pow
Now, why do you want it - I doubt that it will buy you anything in terms of performance. Tony