Browse Source

Math: make the external conversion SFINAE template arguments unnamed.

It's like this in Corrade::Containers already, the reason it was still
named here is probably just historical.
pull/638/head
Vladimír Vondruš 2 years ago
parent
commit
0aff2ec600
  1. 4
      src/Magnum/Math/Bezier.h
  2. 4
      src/Magnum/Math/BitVector.h
  3. 4
      src/Magnum/Math/Color.h
  4. 4
      src/Magnum/Math/Complex.h
  5. 4
      src/Magnum/Math/DualComplex.h
  6. 4
      src/Magnum/Math/DualQuaternion.h
  7. 4
      src/Magnum/Math/Frustum.h
  8. 2
      src/Magnum/Math/Matrix.h
  9. 2
      src/Magnum/Math/Matrix3.h
  10. 2
      src/Magnum/Math/Matrix4.h
  11. 4
      src/Magnum/Math/Quaternion.h
  12. 8
      src/Magnum/Math/Range.h
  13. 4
      src/Magnum/Math/RectangularMatrix.h
  14. 4
      src/Magnum/Math/Vector.h
  15. 2
      src/Magnum/Math/Vector2.h
  16. 2
      src/Magnum/Math/Vector3.h
  17. 2
      src/Magnum/Math/Vector4.h

4
src/Magnum/Math/Bezier.h

@ -137,10 +137,10 @@ template<UnsignedInt order, UnsignedInt dimensions, class T> class Bezier {
template<class U> constexpr explicit Bezier(const Bezier<order, dimensions, U>& other) noexcept: Bezier{typename Containers::Implementation::GenerateSequence<order + 1>::Type{}, other} {}
/** @brief Construct Bézier curve from external representation */
template<class U, class V = decltype(Implementation::BezierConverter<order, dimensions, T, U>::from(std::declval<U>()))> constexpr explicit Bezier(const U& other) noexcept: Bezier<order, dimensions, T>{Implementation::BezierConverter<order, dimensions, T, U>::from(other)} {}
template<class U, class = decltype(Implementation::BezierConverter<order, dimensions, T, U>::from(std::declval<U>()))> constexpr explicit Bezier(const U& other) noexcept: Bezier<order, dimensions, T>{Implementation::BezierConverter<order, dimensions, T, U>::from(other)} {}
/** @brief Convert Bézier curve to external representation */
template<class U, class V = decltype(Implementation::BezierConverter<order, dimensions, T, U>::to(std::declval<Bezier<order, dimensions, T>>()))> constexpr explicit operator U() const {
template<class U, class = decltype(Implementation::BezierConverter<order, dimensions, T, U>::to(std::declval<Bezier<order, dimensions, T>>()))> constexpr explicit operator U() const {
return Implementation::BezierConverter<order, dimensions, T, U>::to(*this);
}

4
src/Magnum/Math/BitVector.h

@ -125,10 +125,10 @@ template<std::size_t size> class BitVector {
#endif
/** @brief Construct a boolean vector from external representation */
template<class U, class V = decltype(Implementation::BitVectorConverter<size, U>::from(std::declval<U>()))> constexpr explicit BitVector(const U& other) noexcept: BitVector{Implementation::BitVectorConverter<size, U>::from(other)} {}
template<class U, class = decltype(Implementation::BitVectorConverter<size, U>::from(std::declval<U>()))> constexpr explicit BitVector(const U& other) noexcept: BitVector{Implementation::BitVectorConverter<size, U>::from(other)} {}
/** @brief Convert a boolean vector to external representation */
template<class U, class V = decltype(Implementation::BitVectorConverter<size, U>::to(std::declval<BitVector<size>>()))> constexpr explicit operator U() const {
template<class U, class = decltype(Implementation::BitVectorConverter<size, U>::to(std::declval<BitVector<size>>()))> constexpr explicit operator U() const {
return Implementation::BitVectorConverter<size, U>::to(*this);
}

4
src/Magnum/Math/Color.h

@ -575,7 +575,7 @@ template<class T> class Color3: public Vector3<T> {
constexpr explicit Color3(const BitVector3& other) noexcept: Vector3<T>{other} {}
/** @brief Construct color from external representation */
template<class U, class V =
template<class U, class =
#ifndef CORRADE_MSVC2015_COMPATIBILITY /* Causes ICE */
decltype(Implementation::VectorConverter<3, T, U>::from(std::declval<U>()))
#else
@ -1063,7 +1063,7 @@ class Color4: public Vector4<T> {
constexpr explicit Color4(const BitVector4& other) noexcept: Vector4<T>{other} {}
/** @brief Construct color from external representation */
template<class U, class V =
template<class U, class =
#ifndef CORRADE_MSVC2015_COMPATIBILITY /* Causes ICE */
decltype(Implementation::VectorConverter<4, T, U>::from(std::declval<U>()))
#else

4
src/Magnum/Math/Complex.h

@ -177,10 +177,10 @@ template<class T> class Complex {
template<class U> constexpr explicit Complex(const Complex<U>& other) noexcept: _real{T(other._real)}, _imaginary{T(other._imaginary)} {}
/** @brief Construct a complex number from external representation */
template<class U, class V = decltype(Implementation::ComplexConverter<T, U>::from(std::declval<U>()))> constexpr explicit Complex(const U& other): Complex{Implementation::ComplexConverter<T, U>::from(other)} {}
template<class U, class = decltype(Implementation::ComplexConverter<T, U>::from(std::declval<U>()))> constexpr explicit Complex(const U& other): Complex{Implementation::ComplexConverter<T, U>::from(other)} {}
/** @brief Convert a complex number to external representation */
template<class U, class V = decltype(Implementation::ComplexConverter<T, U>::to(std::declval<Complex<T>>()))> constexpr explicit operator U() const {
template<class U, class = decltype(Implementation::ComplexConverter<T, U>::to(std::declval<Complex<T>>()))> constexpr explicit operator U() const {
return Implementation::ComplexConverter<T, U>::to(*this);
}

4
src/Magnum/Math/DualComplex.h

@ -183,13 +183,13 @@ template<class T> class DualComplex: public Dual<Complex<T>> {
template<class U> constexpr explicit DualComplex(const DualComplex<U>& other) noexcept: Dual<Complex<T>>{other} {}
/** @brief Construct dual complex number from external representation */
template<class U, class V = decltype(Implementation::DualComplexConverter<T, U>::from(std::declval<U>()))> constexpr explicit DualComplex(const U& other): DualComplex{Implementation::DualComplexConverter<T, U>::from(other)} {}
template<class U, class = decltype(Implementation::DualComplexConverter<T, U>::from(std::declval<U>()))> constexpr explicit DualComplex(const U& other): DualComplex{Implementation::DualComplexConverter<T, U>::from(other)} {}
/** @brief Copy constructor */
constexpr /*implicit*/ DualComplex(const Dual<Complex<T>>& other) noexcept: Dual<Complex<T>>(other) {}
/** @brief Convert dual complex number to external representation */
template<class U, class V = decltype(Implementation::DualComplexConverter<T, U>::to(std::declval<DualComplex<T>>()))> constexpr explicit operator U() const {
template<class U, class = decltype(Implementation::DualComplexConverter<T, U>::to(std::declval<DualComplex<T>>()))> constexpr explicit operator U() const {
return Implementation::DualComplexConverter<T, U>::to(*this);
}

4
src/Magnum/Math/DualQuaternion.h

@ -329,13 +329,13 @@ template<class T> class DualQuaternion: public Dual<Quaternion<T>> {
template<class U> constexpr explicit DualQuaternion(const DualQuaternion<U>& other) noexcept: Dual<Quaternion<T>>(other) {}
/** @brief Construct dual quaternion from external representation */
template<class U, class V = decltype(Implementation::DualQuaternionConverter<T, U>::from(std::declval<U>()))> constexpr explicit DualQuaternion(const U& other): DualQuaternion{Implementation::DualQuaternionConverter<T, U>::from(other)} {}
template<class U, class = decltype(Implementation::DualQuaternionConverter<T, U>::from(std::declval<U>()))> constexpr explicit DualQuaternion(const U& other): DualQuaternion{Implementation::DualQuaternionConverter<T, U>::from(other)} {}
/** @brief Copy constructor */
constexpr /*implicit*/ DualQuaternion(const Dual<Quaternion<T>>& other) noexcept: Dual<Quaternion<T>>(other) {}
/** @brief Convert dual quaternion to external representation */
template<class U, class V = decltype(Implementation::DualQuaternionConverter<T, U>::to(std::declval<DualQuaternion<T>>()))> constexpr explicit operator U() const {
template<class U, class = decltype(Implementation::DualQuaternionConverter<T, U>::to(std::declval<DualQuaternion<T>>()))> constexpr explicit operator U() const {
return Implementation::DualQuaternionConverter<T, U>::to(*this);
}

4
src/Magnum/Math/Frustum.h

@ -113,10 +113,10 @@ template<class T> class Frustum {
template<class U> constexpr explicit Frustum(const Frustum<U>& other) noexcept;
/** @brief Construct frustum from external representation */
template<class U, class V = decltype(Implementation::FrustumConverter<T, U>::from(std::declval<U>()))> constexpr explicit Frustum(const U& other) noexcept: Frustum<T>{Implementation::FrustumConverter<T, U>::from(other)} {}
template<class U, class = decltype(Implementation::FrustumConverter<T, U>::from(std::declval<U>()))> constexpr explicit Frustum(const U& other) noexcept: Frustum<T>{Implementation::FrustumConverter<T, U>::from(other)} {}
/** @brief Convert frustum to external representation */
template<class U, class V = decltype(Implementation::FrustumConverter<T, U>::to(std::declval<Frustum<T>>()))> constexpr explicit operator U() const {
template<class U, class = decltype(Implementation::FrustumConverter<T, U>::to(std::declval<Frustum<T>>()))> constexpr explicit operator U() const {
return Implementation::FrustumConverter<T, U>::to(*this);
}

2
src/Magnum/Math/Matrix.h

@ -100,7 +100,7 @@ template<std::size_t size, class T> class Matrix: public RectangularMatrix<size,
template<class U> constexpr explicit Matrix(const RectangularMatrix<size, size, U>& other) noexcept: RectangularMatrix<size, size, T>(other) {}
/** @brief Construct matrix from external representation */
template<class U, class V = decltype(Implementation::RectangularMatrixConverter<size, size, T, U>::from(std::declval<U>()))> constexpr explicit Matrix(const U& other): RectangularMatrix<size, size, T>(Implementation::RectangularMatrixConverter<size, size, T, U>::from(other)) {}
template<class U, class = decltype(Implementation::RectangularMatrixConverter<size, size, T, U>::from(std::declval<U>()))> constexpr explicit Matrix(const U& other): RectangularMatrix<size, size, T>(Implementation::RectangularMatrixConverter<size, size, T, U>::from(other)) {}
/** @copydoc RectangularMatrix::RectangularMatrix(IdentityInitT, const RectangularMatrix<otherCols, otherRows, T>&, T) */
template<std::size_t otherCols, std::size_t otherRows> constexpr explicit Matrix(IdentityInitT, const RectangularMatrix<otherCols, otherRows, T>& other, T value = T(1)) noexcept: RectangularMatrix<size, size, T>{IdentityInit, other, value} {}

2
src/Magnum/Math/Matrix3.h

@ -305,7 +305,7 @@ template<class T> class Matrix3: public Matrix3x3<T> {
template<class U> constexpr explicit Matrix3(const RectangularMatrix<3, 3, U>& other) noexcept: Matrix3x3<T>(other) {}
/** @brief Construct a matrix from external representation */
template<class U, class V = decltype(Implementation::RectangularMatrixConverter<3, 3, T, U>::from(std::declval<U>()))> constexpr explicit Matrix3(const U& other) noexcept: Matrix3x3<T>(Implementation::RectangularMatrixConverter<3, 3, T, U>::from(other)) {}
template<class U, class = decltype(Implementation::RectangularMatrixConverter<3, 3, T, U>::from(std::declval<U>()))> constexpr explicit Matrix3(const U& other) noexcept: Matrix3x3<T>(Implementation::RectangularMatrixConverter<3, 3, T, U>::from(other)) {}
/** @copydoc RectangularMatrix::RectangularMatrix(IdentityInitT, const RectangularMatrix<otherCols, otherRows, T>&, T) */
template<std::size_t otherCols, std::size_t otherRows> constexpr explicit Matrix3(IdentityInitT, const RectangularMatrix<otherCols, otherRows, T>& other, T value = T(1)) noexcept: Matrix3x3<T>{IdentityInit, other, value} {}

2
src/Magnum/Math/Matrix4.h

@ -571,7 +571,7 @@ template<class T> class Matrix4: public Matrix4x4<T> {
template<class U> constexpr explicit Matrix4(const RectangularMatrix<4, 4, U>& other) noexcept: Matrix4x4<T>(other) {}
/** @brief Construct a matrix from external representation */
template<class U, class V = decltype(Implementation::RectangularMatrixConverter<4, 4, T, U>::from(std::declval<U>()))> constexpr explicit Matrix4(const U& other): Matrix4x4<T>(Implementation::RectangularMatrixConverter<4, 4, T, U>::from(other)) {}
template<class U, class = decltype(Implementation::RectangularMatrixConverter<4, 4, T, U>::from(std::declval<U>()))> constexpr explicit Matrix4(const U& other): Matrix4x4<T>(Implementation::RectangularMatrixConverter<4, 4, T, U>::from(other)) {}
/** @copydoc RectangularMatrix::RectangularMatrix(IdentityInitT, const RectangularMatrix<otherCols, otherRows, T>&, T) */
template<std::size_t otherCols, std::size_t otherRows> constexpr explicit Matrix4(IdentityInitT, const RectangularMatrix<otherCols, otherRows, T>& other, T value = T(1)) noexcept: Matrix4x4<T>{IdentityInit, other, value} {}

4
src/Magnum/Math/Quaternion.h

@ -408,10 +408,10 @@ template<class T> class Quaternion {
template<class U> constexpr explicit Quaternion(const Quaternion<U>& other) noexcept: _vector{other._vector}, _scalar{T(other._scalar)} {}
/** @brief Construct quaternion from external representation */
template<class U, class V = decltype(Implementation::QuaternionConverter<T, U>::from(std::declval<U>()))> constexpr explicit Quaternion(const U& other): Quaternion{Implementation::QuaternionConverter<T, U>::from(other)} {}
template<class U, class = decltype(Implementation::QuaternionConverter<T, U>::from(std::declval<U>()))> constexpr explicit Quaternion(const U& other): Quaternion{Implementation::QuaternionConverter<T, U>::from(other)} {}
/** @brief Convert quaternion to external representation */
template<class U, class V = decltype(Implementation::QuaternionConverter<T, U>::to(std::declval<Quaternion<T>>()))> constexpr explicit operator U() const {
template<class U, class = decltype(Implementation::QuaternionConverter<T, U>::to(std::declval<Quaternion<T>>()))> constexpr explicit operator U() const {
return Implementation::QuaternionConverter<T, U>::to(*this);
}

8
src/Magnum/Math/Range.h

@ -175,10 +175,10 @@ template<UnsignedInt dimensions, class T> class Range {
template<class U> constexpr explicit Range(const Range<dimensions, U>& other) noexcept: _min(other._min), _max(other._max) {}
/** @brief Construct range from external representation */
template<class U, class V = decltype(Implementation::RangeConverter<dimensions, T, U>::from(std::declval<U>()))> constexpr explicit Range(const U& other): Range{Implementation::RangeConverter<dimensions, T, U>::from(other)} {}
template<class U, class = decltype(Implementation::RangeConverter<dimensions, T, U>::from(std::declval<U>()))> constexpr explicit Range(const U& other): Range{Implementation::RangeConverter<dimensions, T, U>::from(other)} {}
/** @brief Convert range to external representation */
template<class U, class V = decltype(Implementation::RangeConverter<dimensions, T, U>::to(std::declval<Range<dimensions, T>>()))> constexpr explicit operator U() const {
template<class U, class = decltype(Implementation::RangeConverter<dimensions, T, U>::to(std::declval<Range<dimensions, T>>()))> constexpr explicit operator U() const {
return Implementation::RangeConverter<dimensions, T, U>::to(*this);
}
@ -470,7 +470,7 @@ template<class T> class Range2D: public Range<2, T> {
/**
* @brief Construct range from external representation
*/
template<class U, class V =
template<class U, class =
#ifndef CORRADE_MSVC2015_COMPATIBILITY /* Causes ICE */
decltype(Implementation::RangeConverter<2, T, U>::from(std::declval<U>()))
#else
@ -621,7 +621,7 @@ template<class T> class Range3D: public Range<3, T> {
/**
* @brief Construct range from external representation
*/
template<class U, class V = decltype(Implementation::RangeConverter<3, T, U>::from(std::declval<U>()))> constexpr explicit Range3D(const U& other) noexcept: Range<3, T>{Implementation::RangeConverter<3, T, U>::from(other)} {}
template<class U, class = decltype(Implementation::RangeConverter<3, T, U>::from(std::declval<U>()))> constexpr explicit Range3D(const U& other) noexcept: Range<3, T>{Implementation::RangeConverter<3, T, U>::from(other)} {}
/** @brief Copy constructor */
constexpr /*implicit*/ Range3D(const Range<3, T>& other) noexcept: Range<3, T>(other) {}

4
src/Magnum/Math/RectangularMatrix.h

@ -213,10 +213,10 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
template<std::size_t otherCols, std::size_t otherRows> constexpr explicit RectangularMatrix(const RectangularMatrix<otherCols, otherRows, T>& other) noexcept: RectangularMatrix<cols, rows, T>{ZeroInit, typename Containers::Implementation::GenerateSequence<cols>::Type{}, other} {}
/** @brief Construct a matrix from external representation */
template<class U, class V = decltype(Implementation::RectangularMatrixConverter<cols, rows, T, U>::from(std::declval<U>()))> constexpr explicit RectangularMatrix(const U& other): RectangularMatrix(Implementation::RectangularMatrixConverter<cols, rows, T, U>::from(other)) {}
template<class U, class = decltype(Implementation::RectangularMatrixConverter<cols, rows, T, U>::from(std::declval<U>()))> constexpr explicit RectangularMatrix(const U& other): RectangularMatrix(Implementation::RectangularMatrixConverter<cols, rows, T, U>::from(other)) {}
/** @brief Convert a matrix to external representation */
template<class U, class V = decltype(Implementation::RectangularMatrixConverter<cols, rows, T, U>::to(std::declval<RectangularMatrix<cols, rows, T>>()))> constexpr explicit operator U() const {
template<class U, class = decltype(Implementation::RectangularMatrixConverter<cols, rows, T, U>::to(std::declval<RectangularMatrix<cols, rows, T>>()))> constexpr explicit operator U() const {
return Implementation::RectangularMatrixConverter<cols, rows, T, U>::to(*this);
}

4
src/Magnum/Math/Vector.h

@ -250,10 +250,10 @@ template<std::size_t size, class T> class Vector {
constexpr explicit Vector(const BitVector<size>& other) noexcept: Vector{typename Containers::Implementation::GenerateSequence<size>::Type{}, other} {}
/** @brief Construct a vector from external representation */
template<class U, class V = decltype(Implementation::VectorConverter<size, T, U>::from(std::declval<U>()))> constexpr explicit Vector(const U& other) noexcept: Vector(Implementation::VectorConverter<size, T, U>::from(other)) {}
template<class U, class = decltype(Implementation::VectorConverter<size, T, U>::from(std::declval<U>()))> constexpr explicit Vector(const U& other) noexcept: Vector(Implementation::VectorConverter<size, T, U>::from(other)) {}
/** @brief Convert a vector to external representation */
template<class U, class V = decltype(Implementation::VectorConverter<size, T, U>::to(std::declval<Vector<size, T>>()))> constexpr explicit operator U() const {
template<class U, class = decltype(Implementation::VectorConverter<size, T, U>::to(std::declval<Vector<size, T>>()))> constexpr explicit operator U() const {
return Implementation::VectorConverter<size, T, U>::to(*this);
}

2
src/Magnum/Math/Vector2.h

@ -144,7 +144,7 @@ template<class T> class Vector2: public Vector<2, T> {
constexpr explicit Vector2(const BitVector2& other) noexcept: Vector<2, T>{other} {}
/** @brief Construct a vector from external representation */
template<class U, class V =
template<class U, class =
#ifndef CORRADE_MSVC2015_COMPATIBILITY /* Causes ICE */
decltype(Implementation::VectorConverter<2, T, U>::from(std::declval<U>()))
#else

2
src/Magnum/Math/Vector3.h

@ -172,7 +172,7 @@ template<class T> class Vector3: public Vector<3, T> {
constexpr explicit Vector3(const BitVector3& other) noexcept: Vector<3, T>{other} {}
/** @brief Construct a vector from external representation */
template<class U, class V =
template<class U, class =
#ifndef CORRADE_MSVC2015_COMPATIBILITY /* Causes ICE */
decltype(Implementation::VectorConverter<3, T, U>::from(std::declval<U>()))
#else

2
src/Magnum/Math/Vector4.h

@ -118,7 +118,7 @@ template<class T> class Vector4: public Vector<4, T> {
constexpr explicit Vector4(const BitVector4& other) noexcept: Vector<4, T>{other} {}
/** @brief Construct a vector from external representation */
template<class U, class V = decltype(Implementation::VectorConverter<4, T, U>::from(std::declval<U>()))> constexpr explicit Vector4(const U& other): Vector<4, T>(Implementation::VectorConverter<4, T, U>::from(other)) {}
template<class U, class = decltype(Implementation::VectorConverter<4, T, U>::from(std::declval<U>()))> constexpr explicit Vector4(const U& other): Vector<4, T>(Implementation::VectorConverter<4, T, U>::from(other)) {}
/** @brief Copy constructor */
constexpr /*implicit*/ Vector4(const Vector<4, T>& other) noexcept: Vector<4, T>(other) {}

Loading…
Cancel
Save