From dc7c5f5fae7facf04af3e6f709bc4be9adb37d1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 6 Aug 2012 16:04:06 +0200 Subject: [PATCH] Just-to-be-sure static_assert()s for Matrix and Vector size. --- src/Math/Matrix.h | 2 ++ src/Math/Vector.h | 2 ++ 2 files changed, 4 insertions(+) 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 */