|
@@ -18,15 +18,22 @@ public:
|
|
|
|
|
|
template<typename... Args>
|
|
|
Vector(float a, Args&&... args) {
|
|
|
- const int size = sizeof...(args) + 1;
|
|
|
- float init[size] = {a, args...};
|
|
|
- static_assert(N == size,
|
|
|
- "vector size and amount of float arguments do not match");
|
|
|
- for(int i = 0; i < N; i++) {
|
|
|
- values[i] = init[i];
|
|
|
- }
|
|
|
+ init<0>(a, args...);
|
|
|
+ }
|
|
|
+
|
|
|
+private:
|
|
|
+ template<int I>
|
|
|
+ void init() {
|
|
|
+ static_assert(I == N, "vector parameters do not match its size");
|
|
|
}
|
|
|
|
|
|
+ template<int I, typename T, typename... Args>
|
|
|
+ void init(T a, Args&&... args) {
|
|
|
+ values[I] = a;
|
|
|
+ init<I + 1>(args...);
|
|
|
+ }
|
|
|
+
|
|
|
+public:
|
|
|
Vector& setAngles(float, float) = delete;
|
|
|
Vector cross(const Vector&) const = delete;
|
|
|
|