Browse Source

Simplified vector init

Kajetan Johannes Hammerle 1 month ago
parent
commit
ee952f7692
1 changed files with 4 additions and 14 deletions
  1. 4 14
      include/core/math/Vector.hpp

+ 4 - 14
include/core/math/Vector.hpp

@@ -18,20 +18,10 @@ namespace Core {
         }
 
         template<typename OT, typename... Args>
-        Vector(OT a, Args&&... args) {
-            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 OT, typename... Args>
-        void init(OT a, Args&&... args) {
-            values[I] = static_cast<T>(a);
-            init<I + 1>(args...);
+        Vector(OT a, Args&&... args)
+            : values(static_cast<T>(a), static_cast<T>(args)...) {
+            static_assert(sizeof...(args) + 1 == N,
+                          "vector parameters do not match its size");
         }
 
     public: