
15 May
2008
15 May
'08
8:20 a.m.
Bruno Lalande wrote:
Hi,
Line 54: return (N%2) ? base*positive_power<N-1>::result(base)
in positive_power causes positive_power to be instantiated with all the integers from N down to 0.
Yep you're right. At that moment I was a bit disturbed by this runtime evaluation but I didn't think precisely about this issue so I left it like that.
Adding a second integral template argument receiving N%2 to specialize on it works (see attachment) but I feel there's a more elegant solution. Maybe using enable_if?
That's more or less what I did in the Sandbox version, but Hervé Brönnimann's solution looks more elegant maybe? John.