been having some issue with a sqrt template function (just want to try, I know < cmath> won't bottleneck anything)
The code below gives the error: too many template arguments
namespace {
static const size_t ITERATIONS = 10;
}
template <typename T, T N> struct Sqrt {
static const T value = Sqrt<T, N, 1, ITERATIONS>::value;
};
//Newtons method: A = (N / A + A) / 2
template <typename T, T N, T A, size_t I> struct Sqrt {
static const T value = Sqrt<T, N, (N / A + A) / 2, I - 1>::value;
};
template <typename T, T N, T A> struct Sqrt<T, N, A, 0> {
static const T value = A;
};
Thanks