Browse Source

Just-to-be-sure static_assert()s for Matrix and Vector size.

pull/279/head
Vladimír Vondruš 14 years ago
parent
commit
dc7c5f5fae
  1. 2
      src/Math/Matrix.h
  2. 2
      src/Math/Vector.h

2
src/Math/Matrix.h

@ -36,6 +36,8 @@ namespace Implementation {
* @todo first col, then row (cache adjacency) * @todo first col, then row (cache adjacency)
*/ */
template<size_t size, class T> class Matrix { template<size_t size, class T> class Matrix {
static_assert(size != 0, "Matrix cannot have zero elements");
friend class Matrix<size+1, T>; /* for ij() */ friend class Matrix<size+1, T>; /* for ij() */
public: public:

2
src/Math/Vector.h

@ -42,6 +42,8 @@ namespace Implementation {
/** @brief %Vector */ /** @brief %Vector */
template<size_t size, class T> class Vector { template<size_t size, class T> class Vector {
static_assert(size != 0, "Vector cannot have zero elements");
public: public:
const static size_t Size = size; /**< @brief %Vector size */ const static size_t Size = size; /**< @brief %Vector size */
typedef T Type; /**< @brief %Vector data type */ typedef T Type; /**< @brief %Vector data type */

Loading…
Cancel
Save