瀏覽代碼

Fixing stack-overflow due to infinite recursion in multiplication function.

Samuel Jaffe 8 年之前
父節點
當前提交
f84c996916
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      vector.hpp

+ 2 - 1
vector.hpp

@@ -182,7 +182,8 @@ VECTOR_ENABLE_IF_LT_N(i, value_type &) name() { return _data[i]; }
     
     template <typename M>
     VECTOR_ENABLE_IF_EQ_T(mul_t<M>, T, N)& operator*=(vector<M, N> c) {
-      return vector<mul_t<M>, N>{*this} *= c;
+      VECTOR_FOR_EACH(i) { _data[i] *= c[i]; }
+      return *this;
     }
     
     template <typename M>