Browse Source

Math: add unary operator+ to all types.

It was implemented only for the Half type and not the others, and I just
felt like using it on a vector now, 12 years after the Vector class got
first added.
pull/594/head
Vladimír Vondruš 4 years ago
parent
commit
0a32bce31b
  1. 1
      doc/changelog.dox
  2. 8
      src/Magnum/Math/Complex.h
  3. 11
      src/Magnum/Math/Dual.h
  4. 8
      src/Magnum/Math/Quaternion.h
  5. 11
      src/Magnum/Math/RectangularMatrix.h
  6. 13
      src/Magnum/Math/Test/ComplexTest.cpp
  7. 15
      src/Magnum/Math/Test/DualTest.cpp
  8. 15
      src/Magnum/Math/Test/QuaternionTest.cpp
  9. 10
      src/Magnum/Math/Test/RectangularMatrixTest.cpp
  10. 12
      src/Magnum/Math/Test/UnitTest.cpp
  11. 13
      src/Magnum/Math/Test/VectorTest.cpp
  12. 8
      src/Magnum/Math/Unit.h
  13. 11
      src/Magnum/Math/Vector.h

1
doc/changelog.dox

@ -179,6 +179,7 @@ See also:
@ref Math::Intersection::pointCircle() / @ref Math::Intersection::pointCircle() /
@relativeref{Math::Intersection,pointSphere()}, which are just wrappers @relativeref{Math::Intersection,pointSphere()}, which are just wrappers
over trivial code but easier to discover over trivial code but easier to discover
- Added an unary @cpp operator+() @ce to all @ref Math classes
@subsubsection changelog-latest-new-meshtools MeshTools library @subsubsection changelog-latest-new-meshtools MeshTools library

8
src/Magnum/Math/Complex.h

@ -288,6 +288,14 @@ template<class T> class Complex {
Vector<2, T>(-_imaginary, _real)}; Vector<2, T>(-_imaginary, _real)};
} }
/**
* @brief Promotion
* @m_since_latest
*
* Returns the value as-is.
*/
Complex<T> operator+() const { return *this; }
/** /**
* @brief Add a complex number and assign * @brief Add a complex number and assign
* *

11
src/Magnum/Math/Dual.h

@ -169,6 +169,14 @@ template<class T> class Dual {
result. WTF, C++?! */ result. WTF, C++?! */
constexpr const T dual() const { return _dual; } /**< @overload */ constexpr const T dual() const { return _dual; } /**< @overload */
/**
* @brief Promotion
* @m_since_latest
*
* Returns the value as-is.
*/
Dual<T> operator+() const { return *this; }
/** /**
* @brief Add and assign dual number * @brief Add and assign dual number
* *
@ -306,6 +314,9 @@ template<class T, class U, class V = typename std::enable_if<!Implementation::Is
#ifndef DOXYGEN_GENERATING_OUTPUT #ifndef DOXYGEN_GENERATING_OUTPUT
#define MAGNUM_DUAL_SUBCLASS_IMPLEMENTATION(Type, Underlying, Multiplicable) \ #define MAGNUM_DUAL_SUBCLASS_IMPLEMENTATION(Type, Underlying, Multiplicable) \
Type<T> operator+() const { \
return Math::Dual<Underlying<T>>::operator+(); \
} \
Type<T> operator-() const { \ Type<T> operator-() const { \
return Math::Dual<Underlying<T>>::operator-(); \ return Math::Dual<Underlying<T>>::operator-(); \
} \ } \

8
src/Magnum/Math/Quaternion.h

@ -465,6 +465,14 @@ template<class T> class Quaternion {
*/ */
Vector3<Rad<T>> toEuler() const; Vector3<Rad<T>> toEuler() const;
/**
* @brief Promotion
* @m_since_latest
*
* Returns the value as-is.
*/
Quaternion<T> operator+() const { return *this; }
/** /**
* @brief Negated quaternion * @brief Negated quaternion
* *

11
src/Magnum/Math/RectangularMatrix.h

@ -334,6 +334,14 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
return toVector() > other.toVector(); return toVector() > other.toVector();
} }
/**
* @brief Promotion
* @m_since_latest
*
* Returns the value as-is.
*/
RectangularMatrix<cols, rows, T> operator+() const { return *this; }
/** /**
* @brief Negated matrix * @brief Negated matrix
* *
@ -732,6 +740,9 @@ extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utili
return Math::RectangularMatrix<cols, rows, T>::fromDiagonal(diagonal); \ return Math::RectangularMatrix<cols, rows, T>::fromDiagonal(diagonal); \
} \ } \
\ \
__VA_ARGS__ operator+() const { \
return Math::RectangularMatrix<cols, rows, T>::operator+(); \
} \
__VA_ARGS__ operator-() const { \ __VA_ARGS__ operator-() const { \
return Math::RectangularMatrix<cols, rows, T>::operator-(); \ return Math::RectangularMatrix<cols, rows, T>::operator-(); \
} \ } \

13
src/Magnum/Math/Test/ComplexTest.cpp

@ -72,8 +72,8 @@ struct ComplexTest: Corrade::TestSuite::Tester {
void isNormalized(); void isNormalized();
template<class T> void isNormalizedEpsilon(); template<class T> void isNormalizedEpsilon();
void promotedNegated();
void addSubtract(); void addSubtract();
void negated();
void multiplyDivideScalar(); void multiplyDivideScalar();
void multiplyDivideVector(); void multiplyDivideVector();
void multiply(); void multiply();
@ -123,8 +123,8 @@ ComplexTest::ComplexTest() {
&ComplexTest::isNormalizedEpsilon<Float>, &ComplexTest::isNormalizedEpsilon<Float>,
&ComplexTest::isNormalizedEpsilon<Double>, &ComplexTest::isNormalizedEpsilon<Double>,
&ComplexTest::promotedNegated,
&ComplexTest::addSubtract, &ComplexTest::addSubtract,
&ComplexTest::negated,
&ComplexTest::multiplyDivideScalar, &ComplexTest::multiplyDivideScalar,
&ComplexTest::multiplyDivideVector, &ComplexTest::multiplyDivideVector,
&ComplexTest::multiply, &ComplexTest::multiply,
@ -324,6 +324,11 @@ template<class T> void ComplexTest::isNormalizedEpsilon() {
CORRADE_VERIFY(!Math::Complex<T>{T(0.801775644243754) + TypeTraits<T>::epsilon()*T(2.0), T(0.597625146975521)}.isNormalized()); CORRADE_VERIFY(!Math::Complex<T>{T(0.801775644243754) + TypeTraits<T>::epsilon()*T(2.0), T(0.597625146975521)}.isNormalized());
} }
void ComplexTest::promotedNegated() {
CORRADE_COMPARE(+Complex(2.5f, -7.4f), Complex(2.5f, -7.4f));
CORRADE_COMPARE(-Complex(2.5f, -7.4f), Complex(-2.5f, 7.4f));
}
void ComplexTest::addSubtract() { void ComplexTest::addSubtract() {
Complex a( 1.7f, -3.7f); Complex a( 1.7f, -3.7f);
Complex b(-3.6f, 0.2f); Complex b(-3.6f, 0.2f);
@ -333,10 +338,6 @@ void ComplexTest::addSubtract() {
CORRADE_COMPARE(c - b, a); CORRADE_COMPARE(c - b, a);
} }
void ComplexTest::negated() {
CORRADE_COMPARE(-Complex(2.5f, -7.4f), Complex(-2.5f, 7.4f));
}
void ComplexTest::multiplyDivideScalar() { void ComplexTest::multiplyDivideScalar() {
Complex a( 2.5f, -0.5f); Complex a( 2.5f, -0.5f);
Complex b(-7.5f, 1.5f); Complex b(-7.5f, 1.5f);

15
src/Magnum/Math/Test/DualTest.cpp

@ -49,8 +49,8 @@ struct DualTest: Corrade::TestSuite::Tester {
void compare(); void compare();
void promotedNegated();
void addSubtract(); void addSubtract();
void negated();
void multiplyDivide(); void multiplyDivide();
void multiplyDivideScalar(); void multiplyDivideScalar();
void multiplyDivideDifferentType(); void multiplyDivideDifferentType();
@ -90,8 +90,8 @@ DualTest::DualTest() {
&DualTest::compare, &DualTest::compare,
&DualTest::promotedNegated,
&DualTest::addSubtract, &DualTest::addSubtract,
&DualTest::negated,
&DualTest::multiplyDivide, &DualTest::multiplyDivide,
&DualTest::multiplyDivideScalar, &DualTest::multiplyDivideScalar,
&DualTest::multiplyDivideDifferentType, &DualTest::multiplyDivideDifferentType,
@ -229,6 +229,11 @@ void DualTest::compare() {
CORRADE_VERIFY(Dual(1.0f, 3.0f) != 1.0f); CORRADE_VERIFY(Dual(1.0f, 3.0f) != 1.0f);
} }
void DualTest::promotedNegated() {
CORRADE_COMPARE(+Dual(1.0f, -6.5f), Dual(1.0f, -6.5f));
CORRADE_COMPARE(-Dual(1.0f, -6.5f), Dual(-1.0f, 6.5f));
}
void DualTest::addSubtract() { void DualTest::addSubtract() {
Dual a(2.0f, -7.5f); Dual a(2.0f, -7.5f);
Dual b(-3.3f, 0.2f); Dual b(-3.3f, 0.2f);
@ -238,10 +243,6 @@ void DualTest::addSubtract() {
CORRADE_COMPARE(c - b, a); CORRADE_COMPARE(c - b, a);
} }
void DualTest::negated() {
CORRADE_COMPARE(-Dual(1.0f, -6.5f), Dual(-1.0f, 6.5f));
}
void DualTest::multiplyDivide() { void DualTest::multiplyDivide() {
Dual a(1.5f, -4.0f); Dual a(1.5f, -4.0f);
Dual b(-2.0f, 0.5f); Dual b(-2.0f, 0.5f);
@ -329,6 +330,7 @@ typedef BasicDualVec2<Float> DualVec2;
void DualTest::subclassTypes() { void DualTest::subclassTypes() {
const DualVec2 a; const DualVec2 a;
CORRADE_VERIFY(std::is_same<decltype(+a), DualVec2>::value);
CORRADE_VERIFY(std::is_same<decltype(-a), DualVec2>::value); CORRADE_VERIFY(std::is_same<decltype(-a), DualVec2>::value);
CORRADE_VERIFY(std::is_same<decltype(a + a), DualVec2>::value); CORRADE_VERIFY(std::is_same<decltype(a + a), DualVec2>::value);
CORRADE_VERIFY(std::is_same<decltype(a - a), DualVec2>::value); CORRADE_VERIFY(std::is_same<decltype(a - a), DualVec2>::value);
@ -356,6 +358,7 @@ void DualTest::subclass() {
const DualVec2 c{Vector2{4.5f, 0.8f}, Vector2{-3.8f, 0.3f}}; const DualVec2 c{Vector2{4.5f, 0.8f}, Vector2{-3.8f, 0.3f}};
const DualVec2 d{Vector2{4.5f, -2.4f}, Vector2{-11.7f, -3.56f}}; const DualVec2 d{Vector2{4.5f, -2.4f}, Vector2{-11.7f, -3.56f}};
CORRADE_COMPARE(+a, (DualVec2{Vector2{1.5f, 2.0f}, Vector2{-4.0f, 1.3f}}));
CORRADE_COMPARE(-a, (DualVec2{Vector2{-1.5f, -2.0f}, Vector2{4.0f, -1.3f}})); CORRADE_COMPARE(-a, (DualVec2{Vector2{-1.5f, -2.0f}, Vector2{4.0f, -1.3f}}));
CORRADE_COMPARE(a + b, c); CORRADE_COMPARE(a + b, c);
CORRADE_COMPARE(c - b, a); CORRADE_COMPARE(c - b, a);

15
src/Magnum/Math/Test/QuaternionTest.cpp

@ -76,8 +76,8 @@ struct QuaternionTest: Corrade::TestSuite::Tester {
void axisAngle(); void axisAngle();
void axisAngleNotNormalized(); void axisAngleNotNormalized();
void promotedNegated();
void addSubtract(); void addSubtract();
void negated();
void multiplyDivideScalar(); void multiplyDivideScalar();
void multiply(); void multiply();
@ -156,8 +156,8 @@ QuaternionTest::QuaternionTest() {
&QuaternionTest::axisAngle, &QuaternionTest::axisAngle,
&QuaternionTest::axisAngleNotNormalized, &QuaternionTest::axisAngleNotNormalized,
&QuaternionTest::promotedNegated,
&QuaternionTest::addSubtract, &QuaternionTest::addSubtract,
&QuaternionTest::negated,
&QuaternionTest::multiplyDivideScalar, &QuaternionTest::multiplyDivideScalar,
&QuaternionTest::multiply, &QuaternionTest::multiply,
@ -383,6 +383,13 @@ void QuaternionTest::axisAngleNotNormalized() {
"Math::Quaternion::axis(): Quaternion({0.239242, -0.318989, 0}, 1.95985) is not normalized\n"); "Math::Quaternion::axis(): Quaternion({0.239242, -0.318989, 0}, 1.95985) is not normalized\n");
} }
void QuaternionTest::promotedNegated() {
CORRADE_COMPARE(+Quaternion({1.0f, 2.0f, -3.0f}, -4.0f),
Quaternion({1.0f, 2.0f, -3.0f}, -4.0f));
CORRADE_COMPARE(-Quaternion({1.0f, 2.0f, -3.0f}, -4.0f),
Quaternion({-1.0f, -2.0f, 3.0f}, 4.0f));
}
void QuaternionTest::addSubtract() { void QuaternionTest::addSubtract() {
Quaternion a({ 1.0f, 3.0f, -2.0f}, -4.0f); Quaternion a({ 1.0f, 3.0f, -2.0f}, -4.0f);
Quaternion b({-0.5f, 1.4f, 3.0f}, 12.0f); Quaternion b({-0.5f, 1.4f, 3.0f}, 12.0f);
@ -392,10 +399,6 @@ void QuaternionTest::addSubtract() {
CORRADE_COMPARE(c - b, a); CORRADE_COMPARE(c - b, a);
} }
void QuaternionTest::negated() {
CORRADE_COMPARE(-Quaternion({1.0f, 2.0f, -3.0f}, -4.0f), Quaternion({-1.0f, -2.0f, 3.0f}, 4.0f));
}
void QuaternionTest::multiplyDivideScalar() { void QuaternionTest::multiplyDivideScalar() {
Quaternion a({ 1.0f, 3.0f, -2.0f}, -4.0f); Quaternion a({ 1.0f, 3.0f, -2.0f}, -4.0f);
Quaternion b({-1.5f, -4.5f, 3.0f}, 6.0f); Quaternion b({-1.5f, -4.5f, 3.0f}, 6.0f);

10
src/Magnum/Math/Test/RectangularMatrixTest.cpp

@ -78,7 +78,7 @@ struct RectangularMatrixTest: Corrade::TestSuite::Tester {
void compare(); void compare();
void compareComponentWise(); void compareComponentWise();
void negative(); void promotedNegated();
void addSubtract(); void addSubtract();
void multiplyDivide(); void multiplyDivide();
void multiply(); void multiply();
@ -139,7 +139,7 @@ RectangularMatrixTest::RectangularMatrixTest() {
&RectangularMatrixTest::compare, &RectangularMatrixTest::compare,
&RectangularMatrixTest::compareComponentWise, &RectangularMatrixTest::compareComponentWise,
&RectangularMatrixTest::negative, &RectangularMatrixTest::promotedNegated,
&RectangularMatrixTest::addSubtract, &RectangularMatrixTest::addSubtract,
&RectangularMatrixTest::multiplyDivide, &RectangularMatrixTest::multiplyDivide,
&RectangularMatrixTest::multiply, &RectangularMatrixTest::multiply,
@ -478,11 +478,12 @@ void RectangularMatrixTest::compareComponentWise() {
CORRADE_COMPARE(Matrix3x1(1.0f, -1.0f, 5.0f) > Matrix3x1(1.1f, -1.0f, 3.0f), BitVector3(0x4)); CORRADE_COMPARE(Matrix3x1(1.0f, -1.0f, 5.0f) > Matrix3x1(1.1f, -1.0f, 3.0f), BitVector3(0x4));
} }
void RectangularMatrixTest::negative() { void RectangularMatrixTest::promotedNegated() {
Matrix2x2 matrix(Vector2(1.0f, -3.0f), Matrix2x2 matrix(Vector2(1.0f, -3.0f),
Vector2(5.0f, -10.0f)); Vector2(5.0f, -10.0f));
Matrix2x2 negated(Vector2(-1.0f, 3.0f), Matrix2x2 negated(Vector2(-1.0f, 3.0f),
Vector2(-5.0f, 10.0f)); Vector2(-5.0f, 10.0f));
CORRADE_COMPARE(+matrix, matrix);
CORRADE_COMPARE(-matrix, negated); CORRADE_COMPARE(-matrix, negated);
} }
@ -676,6 +677,7 @@ void RectangularMatrixTest::subclassTypes() {
/* Const operators */ /* Const operators */
const Mat2x2 c; const Mat2x2 c;
CORRADE_VERIFY(std::is_same<decltype(+c), Mat2x2>::value);
CORRADE_VERIFY(std::is_same<decltype(-c), Mat2x2>::value); CORRADE_VERIFY(std::is_same<decltype(-c), Mat2x2>::value);
CORRADE_VERIFY(std::is_same<decltype(c + c), Mat2x2>::value); CORRADE_VERIFY(std::is_same<decltype(c + c), Mat2x2>::value);
CORRADE_VERIFY(std::is_same<decltype(c*1.0f), Mat2x2>::value); CORRADE_VERIFY(std::is_same<decltype(c*1.0f), Mat2x2>::value);
@ -718,6 +720,8 @@ void RectangularMatrixTest::subclass() {
/* Constexpr constructor */ /* Constexpr constructor */
constexpr Mat2x2 a(Vector2(1.0f, -3.0f), constexpr Mat2x2 a(Vector2(1.0f, -3.0f),
Vector2(-3.0f, 1.0f)); Vector2(-3.0f, 1.0f));
CORRADE_COMPARE(+a, Mat2x2(Vector2(1.0f, -3.0f),
Vector2(-3.0f, 1.0f)));
CORRADE_COMPARE(-a, Mat2x2(Vector2(-1.0f, 3.0f), CORRADE_COMPARE(-a, Mat2x2(Vector2(-1.0f, 3.0f),
Vector2(3.0f, -1.0f))); Vector2(3.0f, -1.0f)));

12
src/Magnum/Math/Test/UnitTest.cpp

@ -44,7 +44,7 @@ struct UnitTest: Corrade::TestSuite::Tester {
void compare(); void compare();
void compareNaN(); void compareNaN();
void negated(); void promotedNegated();
void addSubtract(); void addSubtract();
void multiplyDivide(); void multiplyDivide();
}; };
@ -59,7 +59,7 @@ UnitTest::UnitTest() {
&UnitTest::compare, &UnitTest::compare,
&UnitTest::compareNaN, &UnitTest::compareNaN,
&UnitTest::negated, &UnitTest::promotedNegated,
&UnitTest::addSubtract, &UnitTest::addSubtract,
&UnitTest::multiplyDivide}); &UnitTest::multiplyDivide});
} }
@ -178,10 +178,12 @@ void UnitTest::compareNaN() {
CORRADE_VERIFY(!(Sec{Constants::nan()} == Sec{Constants::nan()})); CORRADE_VERIFY(!(Sec{Constants::nan()} == Sec{Constants::nan()}));
} }
void UnitTest::negated() { void UnitTest::promotedNegated() {
constexpr Sec a(25.0f); constexpr Sec a(25.0f);
constexpr Sec b(-a); constexpr Sec b(+a);
CORRADE_COMPARE(b, Sec(-25.0f)); constexpr Sec c(-a);
CORRADE_COMPARE(b, Sec(+25.0f));
CORRADE_COMPARE(c, Sec(-25.0f));
} }
void UnitTest::addSubtract() { void UnitTest::addSubtract() {

13
src/Magnum/Math/Test/VectorTest.cpp

@ -76,7 +76,7 @@ struct VectorTest: Corrade::TestSuite::Tester {
void data(); void data();
void negative(); void promotedNegated();
void addSubtract(); void addSubtract();
void multiplyDivide(); void multiplyDivide();
void multiplyDivideIntegral(); void multiplyDivideIntegral();
@ -151,7 +151,7 @@ VectorTest::VectorTest() {
&VectorTest::data, &VectorTest::data,
&VectorTest::negative, &VectorTest::promotedNegated,
&VectorTest::addSubtract, &VectorTest::addSubtract,
&VectorTest::multiplyDivide, &VectorTest::multiplyDivide,
&VectorTest::multiplyDivideIntegral, &VectorTest::multiplyDivideIntegral,
@ -392,8 +392,11 @@ void VectorTest::compareComponentWise() {
CORRADE_COMPARE(Vector3(1.0f, -1.0f, 5.0f) > Vector3(1.1f, -1.0f, 3.0f), BitVector3(0x4)); CORRADE_COMPARE(Vector3(1.0f, -1.0f, 5.0f) > Vector3(1.1f, -1.0f, 3.0f), BitVector3(0x4));
} }
void VectorTest::negative() { void VectorTest::promotedNegated() {
CORRADE_COMPARE(-Vector4(1.0f, -3.0f, 5.0f, -10.0f), Vector4(-1.0f, 3.0f, -5.0f, 10.0f)); CORRADE_COMPARE(+Vector4(1.0f, -3.0f, 5.0f, -10.0f),
Vector4(1.0f, -3.0f, 5.0f, -10.0f));
CORRADE_COMPARE(-Vector4(1.0f, -3.0f, 5.0f, -10.0f),
Vector4(-1.0f, 3.0f, -5.0f, 10.0f));
} }
void VectorTest::addSubtract() { void VectorTest::addSubtract() {
@ -651,6 +654,7 @@ void VectorTest::subclassTypes() {
/* Const operators */ /* Const operators */
const Vec2 c; const Vec2 c;
const Vec2 c2; const Vec2 c2;
CORRADE_VERIFY(std::is_same<decltype(+c), Vec2>::value);
CORRADE_VERIFY(std::is_same<decltype(-c), Vec2>::value); CORRADE_VERIFY(std::is_same<decltype(-c), Vec2>::value);
CORRADE_VERIFY(std::is_same<decltype(c + c), Vec2>::value); CORRADE_VERIFY(std::is_same<decltype(c + c), Vec2>::value);
CORRADE_VERIFY(std::is_same<decltype(c*1.0f), Vec2>::value); CORRADE_VERIFY(std::is_same<decltype(c*1.0f), Vec2>::value);
@ -734,6 +738,7 @@ void VectorTest::subclass() {
constexpr const Vec2 a{-2.0f, 5.0f}; constexpr const Vec2 a{-2.0f, 5.0f};
CORRADE_COMPARE(a[0], -2.0f); CORRADE_COMPARE(a[0], -2.0f);
CORRADE_COMPARE(+Vec2(-2.0f, 5.0f), Vec2(-2.0f, 5.0f));
CORRADE_COMPARE(-Vec2(-2.0f, 5.0f), Vec2(2.0f, -5.0f)); CORRADE_COMPARE(-Vec2(-2.0f, 5.0f), Vec2(2.0f, -5.0f));
CORRADE_COMPARE(Vec2(-2.0f, 5.0f) + Vec2(1.0f, -3.0f), Vec2(-1.0f, 2.0f)); CORRADE_COMPARE(Vec2(-2.0f, 5.0f) + Vec2(1.0f, -3.0f), Vec2(-1.0f, 2.0f));
CORRADE_COMPARE(Vec2(-2.0f, 5.0f) - Vec2(1.0f, -3.0f), Vec2(-3.0f, 8.0f)); CORRADE_COMPARE(Vec2(-2.0f, 5.0f) - Vec2(1.0f, -3.0f), Vec2(-3.0f, 8.0f));

8
src/Magnum/Math/Unit.h

@ -98,6 +98,14 @@ template<template<class> class Derived, class T> class Unit {
return !operator<(other); return !operator<(other);
} }
/**
* @brief Promotion
* @m_since_latest
*
* Returns the value as-is.
*/
constexpr Unit<Derived, T> operator+() const { return *this; }
/** @brief Negated value */ /** @brief Negated value */
constexpr Unit<Derived, T> operator-() const { constexpr Unit<Derived, T> operator-() const {
return Unit<Derived, T>(-_value); return Unit<Derived, T>(-_value);

11
src/Magnum/Math/Vector.h

@ -330,6 +330,14 @@ template<std::size_t size, class T> class Vector {
return Implementation::isNormalizedSquared(dot()); return Implementation::isNormalizedSquared(dot());
} }
/**
* @brief Promotion
* @m_since_latest
*
* Returns the value as-is.
*/
Vector<size, T> operator+() const { return *this; }
/** /**
* @brief Negated vector * @brief Negated vector
* *
@ -1280,6 +1288,9 @@ extern template MAGNUM_EXPORT Corrade::Utility::Debug& operator<<(Corrade::Utili
return Math::Vector<size, T>::pad(a, value); \ return Math::Vector<size, T>::pad(a, value); \
} \ } \
\ \
Type<T> operator+() const { \
return Math::Vector<size, T>::operator+(); \
} \
template<class U = T> typename std::enable_if<std::is_signed<U>::value, Type<T>>::type \ template<class U = T> typename std::enable_if<std::is_signed<U>::value, Type<T>>::type \
operator-() const { \ operator-() const { \
return Math::Vector<size, T>::operator-(); \ return Math::Vector<size, T>::operator-(); \

Loading…
Cancel
Save