Mojmir Svoboda schreef:
i do not attempt to answer your problem, but i thought traditional way to do
compile-time computation was like:
template<int N>
struct fib {
static int const n = fib<N-1>::n + fib<N-2>::n;
};
template<>
struct fib<0> {
static int const n = 0;
};
template<>
struct fib<1> {
static int const n = 1;
};
(or using enums) which behaves much better for me. local gurus will probably
explain best why..
best regards,
mojmir
You're right. Judging from the resulting object file it's much cleaner and it
also works for large values of N. Still I wonder why the second function
template version of the algorithm in my previous e-mail behaves the way it does.
Perhaps it's doing computation on 2^N integers?
Regards,
Guido