![]() |
Boost : |
From: John Maddock (john_at_[hidden])
Date: 2008-05-15 04:20:17
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.
Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk