From 28c31bfc96f1061754a328ef0b452eebbd13a084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 30 Nov 2016 11:00:01 +0100 Subject: [PATCH] Math: I don't see why we should have those overloads. The compiler does that for us. Probably a brain fart from 2010. On the other hand, the ConfigurationValue specializations need to be there, because the type is used explicitly as template parameter. --- src/Magnum/Math/Color.h | 20 ++++++++++---------- src/Magnum/Math/Matrix.h | 5 ----- src/Magnum/Math/Matrix3.h | 5 ----- src/Magnum/Math/Matrix4.h | 5 ----- src/Magnum/Math/Vector2.h | 5 ----- src/Magnum/Math/Vector3.h | 5 ----- src/Magnum/Math/Vector4.h | 5 ----- 7 files changed, 10 insertions(+), 40 deletions(-) diff --git a/src/Magnum/Math/Color.h b/src/Magnum/Math/Color.h index 3b1555f85..44414897e 100644 --- a/src/Magnum/Math/Color.h +++ b/src/Magnum/Math/Color.h @@ -610,20 +610,20 @@ inline Color4 operator "" _rgbaf(unsigned long long value) { } -/** @debugoperator{Magnum::Math::Color3} */ -template inline Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Color3& value) { - return debug << static_cast&>(value); -} +/** +@debugoperator{Magnum::Math::Color3} -/** @debugoperator{Magnum::Math::Color3} */ +Prints the value as hex color (e.g. `#ff33aa`). Other underlying types are +handled by @ref operator<<(Corrade::Utility::Debug&, const Vector&). +*/ MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Color3& value); -/** @debugoperator{Magnum::Math::Color4} */ -template inline Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Color4& value) { - return debug << static_cast&>(value); -} +/** +@debugoperator{Magnum::Math::Color4} -/** @debugoperator{Magnum::Math::Color4} */ +Prints the value as hex color (e.g. `#9933aaff`). Other underlying types are +handled by @ref operator<<(Corrade::Utility::Debug&, const Vector&). +*/ MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Color4& value); namespace Implementation { diff --git a/src/Magnum/Math/Matrix.h b/src/Magnum/Math/Matrix.h index 7ed4b997e..3d4525d89 100644 --- a/src/Magnum/Math/Matrix.h +++ b/src/Magnum/Math/Matrix.h @@ -259,11 +259,6 @@ template using Matrix4x4 = Matrix<4, T>; MAGNUM_MATRIX_OPERATOR_IMPLEMENTATION(Matrix) -/** @debugoperator{Magnum::Math::Matrix} */ -template inline Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Matrix& value) { - return debug << static_cast&>(value); -} - #ifndef DOXYGEN_GENERATING_OUTPUT #define MAGNUM_MATRIX_SUBCLASS_IMPLEMENTATION(size, Type, VectorType) \ VectorType& operator[](std::size_t col) { \ diff --git a/src/Magnum/Math/Matrix3.h b/src/Magnum/Math/Matrix3.h index 9eb69bf2d..e3646f770 100644 --- a/src/Magnum/Math/Matrix3.h +++ b/src/Magnum/Math/Matrix3.h @@ -407,11 +407,6 @@ template class Matrix3: public Matrix3x3 { MAGNUM_MATRIXn_OPERATOR_IMPLEMENTATION(3, Matrix3) #endif -/** @debugoperator{Magnum::Math::Matrix3} */ -template inline Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Matrix3& value) { - return debug << static_cast&>(value); -} - template Matrix3 Matrix3::rotation(const Rad angle) { const T sine = std::sin(T(angle)); const T cosine = std::cos(T(angle)); diff --git a/src/Magnum/Math/Matrix4.h b/src/Magnum/Math/Matrix4.h index fda1c3a6d..7c96f4f80 100644 --- a/src/Magnum/Math/Matrix4.h +++ b/src/Magnum/Math/Matrix4.h @@ -582,11 +582,6 @@ template class Matrix4: public Matrix4x4 { MAGNUM_MATRIXn_OPERATOR_IMPLEMENTATION(4, Matrix4) #endif -/** @debugoperator{Magnum::Math::Matrix4} */ -template inline Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Matrix4& value) { - return debug << static_cast&>(value); -} - template Matrix4 Matrix4::rotation(const Rad angle, const Vector3& normalizedAxis) { CORRADE_ASSERT(normalizedAxis.isNormalized(), "Math::Matrix4::rotation(): axis must be normalized", {}); diff --git a/src/Magnum/Math/Vector2.h b/src/Magnum/Math/Vector2.h index 1c6d68e2d..d1870107d 100644 --- a/src/Magnum/Math/Vector2.h +++ b/src/Magnum/Math/Vector2.h @@ -199,11 +199,6 @@ template class Vector2: public Vector<2, T> { MAGNUM_VECTORn_OPERATOR_IMPLEMENTATION(2, Vector2) #endif -/** @debugoperator{Magnum::Math::Vector2} */ -template inline Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Vector2& value) { - return debug << static_cast&>(value); -} - namespace Implementation { template struct TypeForSize; template struct TypeForSize<2, T> { typedef Math::Vector2 Type; }; diff --git a/src/Magnum/Math/Vector3.h b/src/Magnum/Math/Vector3.h index 0b14ea04e..10f989ee7 100644 --- a/src/Magnum/Math/Vector3.h +++ b/src/Magnum/Math/Vector3.h @@ -252,11 +252,6 @@ template class Vector3: public Vector<3, T> { MAGNUM_VECTORn_OPERATOR_IMPLEMENTATION(3, Vector3) #endif -/** @debugoperator{Magnum::Math::Vector3} */ -template inline Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Vector3& value) { - return debug << static_cast&>(value); -} - namespace Implementation { template struct TypeForSize<3, T> { typedef Math::Vector3 Type; }; } diff --git a/src/Magnum/Math/Vector4.h b/src/Magnum/Math/Vector4.h index 1323b3ee4..6aab6f475 100644 --- a/src/Magnum/Math/Vector4.h +++ b/src/Magnum/Math/Vector4.h @@ -206,11 +206,6 @@ template class Vector4: public Vector<4, T> { MAGNUM_VECTORn_OPERATOR_IMPLEMENTATION(4, Vector4) #endif -/** @debugoperator{Magnum::Math::Vector4} */ -template inline Corrade::Utility::Debug& operator<<(Corrade::Utility::Debug& debug, const Vector4& value) { - return debug << static_cast&>(value); -} - namespace Implementation { template struct TypeForSize<4, T> { typedef Math::Vector4 Type; }; }