Original Post
Hi, i have typed this code example from the book C++ templates, chapter 17, template meta programming.
i got two compiler errors in MSVC++ 6.0, C2989 (template class has already been defined as a non-template class) and C2988 (unrecognizable template declaration/definition).
Do i need a newer compiler??
I would be glad to get any help!
Thanks
Gammastrahler
[edited by - Gammastrahler on March 10, 2003 4:57:41 PM]
template <int DIM, typename T>
class DotProduct
{
public:
static T result(T* a, T* b)
{
return *a * *b + DotProduct<DIM - 1, T>::result(a + 1, b + 1);
}
};
template <typename T>
class DotProduct<1, T>
{
static T result(T* a, T* b)
{
return DotProduct<DIM, T>::result(a, b);
}
};
