diff --git a/src/Math/Matrix.h b/src/Math/Matrix.h index 8dfd40d93..540f46d7b 100644 --- a/src/Math/Matrix.h +++ b/src/Math/Matrix.h @@ -36,6 +36,8 @@ namespace Implementation { * @todo first col, then row (cache adjacency) */ template class Matrix { + static_assert(size != 0, "Matrix cannot have zero elements"); + friend class Matrix; /* for ij() */ public: diff --git a/src/Math/Vector.h b/src/Math/Vector.h index 7bd884fbc..6c4242529 100644 --- a/src/Math/Vector.h +++ b/src/Math/Vector.h @@ -42,6 +42,8 @@ namespace Implementation { /** @brief %Vector */ template class Vector { + static_assert(size != 0, "Vector cannot have zero elements"); + public: const static size_t Size = size; /**< @brief %Vector size */ typedef T Type; /**< @brief %Vector data type */