From 2c52f7b85a90171fe7f1e8e62ce508d5939de32e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 1 Oct 2012 17:49:42 +0200 Subject: [PATCH] Non-explicit default constructor for Vector2 and Matrix*. So you can now write mat = {}; vec = {}; instead of mat = Matrix3(); vec = Vector2(); --- src/Math/Matrix.h | 2 +- src/Math/Matrix3.h | 2 +- src/Math/Matrix4.h | 2 +- src/Math/Vector2.h | 5 ++++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Math/Matrix.h b/src/Math/Matrix.h index 065617261..58ac344ae 100644 --- a/src/Math/Matrix.h +++ b/src/Math/Matrix.h @@ -62,7 +62,7 @@ template class Matrix: public RectangularMatrix { * `Matrix m(Matrix::Identity);`. Optional parameter @p value allows * you to specify value on diagonal. */ - inline explicit Matrix(IdentityType = Identity, T value = T(1)) { + inline Matrix(IdentityType = Identity, T value = T(1)) { for(size_t i = 0; i != size; ++i) (*this)(i, i) = value; } diff --git a/src/Math/Matrix3.h b/src/Math/Matrix3.h index 5d80e6b6f..e904975e0 100644 --- a/src/Math/Matrix3.h +++ b/src/Math/Matrix3.h @@ -86,7 +86,7 @@ template class Matrix3: public Matrix<3, T> { inline constexpr explicit Matrix3(typename Matrix<3, T>::ZeroType): Matrix<3, T>(Matrix<3, T>::Zero) {} /** @copydoc Matrix::Matrix(IdentityType, T) */ - inline constexpr explicit Matrix3(typename Matrix<3, T>::IdentityType = (Matrix<3, T>::Identity), T value = T(1)): Matrix<3, T>( + inline constexpr Matrix3(typename Matrix<3, T>::IdentityType = (Matrix<3, T>::Identity), T value = T(1)): Matrix<3, T>( value, T(0), T(0), T(0), value, T(0), T(0), T(0), value diff --git a/src/Math/Matrix4.h b/src/Math/Matrix4.h index b741eb27a..e9a6a4231 100644 --- a/src/Math/Matrix4.h +++ b/src/Math/Matrix4.h @@ -176,7 +176,7 @@ template class Matrix4: public Matrix<4, T> { inline constexpr explicit Matrix4(typename Matrix<4, T>::ZeroType): Matrix<4, T>(Matrix<4, T>::Zero) {} /** @copydoc Matrix::Matrix(IdentityType, T) */ - inline constexpr explicit Matrix4(typename Matrix<4, T>::IdentityType = (Matrix<4, T>::Identity), T value = T(1)): Matrix<4, T>( + inline constexpr Matrix4(typename Matrix<4, T>::IdentityType = (Matrix<4, T>::Identity), T value = T(1)): Matrix<4, T>( value, T(0), T(0), T(0), T(0), value, T(0), T(0), T(0), T(0), value, T(0), diff --git a/src/Math/Vector2.h b/src/Math/Vector2.h index 72c98d3b6..c4d26eb11 100644 --- a/src/Math/Vector2.h +++ b/src/Math/Vector2.h @@ -70,8 +70,11 @@ template class Vector2: public Vector<2, T> { */ inline constexpr static Vector2 yScale(T scale) { return Vector2(T(1), scale); } + /** @copydoc Vector::Vector() */ + inline constexpr Vector2() {} + /** @copydoc Vector::Vector(T) */ - inline constexpr explicit Vector2(T value = T()): Vector<2, T>(value, value) {} + inline constexpr explicit Vector2(T value): Vector<2, T>(value, value) {} /** @brief Copy constructor */ inline constexpr Vector2(const RectangularMatrix<1, 2, T>& other): Vector<2, T>(other) {}