From: John Moeller (fishcorn_at_[hidden])
Date: 2008-05-14 22:04:27
Bruno Lalande <bruno.lalande <at> gmail.com> writes:
> > 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?
template <int N>
template <typename T>
static typename tools::promote_args<T>::type result(T base)
return ((N%2) ? base : 1) *
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk