const T &operator[](unsigned i) const { return *(&x+i); }
};
+template<typename T>
+class VectorComponents<T, 4>
+{
+public:
+ T x, y, z, w;
+
+protected:
+ VectorComponents() { }
+
+public:
+ T &operator[](unsigned i) { return *(&x+i); }
+ const T &operator[](unsigned i) const { return *(&x+i); }
+};
+
/**
A general mathematical vector.
*/
Vector(const T *);
Vector(T, T);
Vector(T, T, T);
+ Vector(T, T, T, T);
template<typename U>
Vector(const Vector<U, N> &);
this->VectorComponents<T, 3>::z = z_;
}
+template<typename T, unsigned N>
+inline Vector<T, N>::Vector(T x_, T y_, T z_, T w_)
+{
+ this->VectorComponents<T, 4>::x = x_;
+ this->VectorComponents<T, 4>::y = y_;
+ this->VectorComponents<T, 4>::z = z_;
+ this->VectorComponents<T, 4>::w = w_;
+}
+
template<typename T, unsigned N>
template<typename U>
inline Vector<T, N>::Vector(const Vector<U, N> &v)