A small addition and look how *fugly and uber-verbose* operator==() is:

Code:

template <const size_t DIMENSIONS, typename T>
class Vector
{
public:
const static size_t mDimensions = DIMENSIONS;
Vector();
Vector(T x, ...);
// Equality
bool operator ==(const Vector<DIMENSIONS, T> &other);
private:
T mComponents[DIMENSIONS];
};
template <const size_t DIMENSIONS, typename T>
Vector<DIMENSIONS, T>::Vector()
{
for (size_t i = 0; i < DIMENSIONS; i++)
{
mComponents[i] = static_cast<T>(0);
}
}
template <const size_t DIMENSIONS, typename T>
Vector<DIMENSIONS, T>::Vector(T x, ...)
{
va_list args;
int j = x;
va_start(args, x);
for (size_t i = 0; i < DIMENSIONS, j != -1; i++)
{
mComponents[i] = j;
j = va_arg(args, T);
}
va_end(args);
}
// Test for equality.
template <const size_t DIMENSIONS, typename T>
bool Vector<DIMENSIONS, T>::operator ==(const Vector<DIMENSIONS, T> &other)
{
_ASSERTE(mDimensions == other.mDimensions);
for (size_t i = 0; i < DIMENSIONS; i++)
{
if (mComponents[i] != other.mComponents[i])
return false;
}
return true;
}
int main(int argc, char *argv[])
{
Vector<2, int> vec(0, 0);
return 0;
}