diff --git a/src/Magnum/Math/Angle.h b/src/Magnum/Math/Angle.h index 91ca09b73..2f8447234 100644 --- a/src/Magnum/Math/Angle.h +++ b/src/Magnum/Math/Angle.h @@ -127,20 +127,20 @@ template class Deg: public Unit { public: /** @brief Construct zero angle */ /* MSVC 2015 can't handle {} here */ - constexpr /*implicit*/ Deg(ZeroInitT = ZeroInit): Unit(ZeroInit) {} + constexpr /*implicit*/ Deg(ZeroInitT = ZeroInit) noexcept: Unit(ZeroInit) {} /** @brief Construct without initializing the contents */ /* MSVC 2015 can't handle {} here */ - explicit Deg(NoInitT): Unit(NoInit) {} + explicit Deg(NoInitT) noexcept: Unit(NoInit) {} /** @brief Explicit constructor from unitless type */ - constexpr explicit Deg(T value): Unit(value) {} - - /** @brief Copy constructor */ - constexpr /*implicit*/ Deg(Unit value): Unit(value) {} + constexpr explicit Deg(T value) noexcept: Unit(value) {} /** @brief Construct from another underlying type */ - template constexpr explicit Deg(Unit value): Unit(value) {} + template constexpr explicit Deg(Unit value) noexcept: Unit(value) {} + + /** @brief Copy constructor */ + constexpr /*implicit*/ Deg(Unit other) noexcept: Unit(other) {} /** * @brief Construct degrees from radians @@ -191,20 +191,20 @@ template class Rad: public Unit { public: /** @brief Default constructor */ /* MSVC 2015 can't handle {} here */ - constexpr /*implicit*/ Rad(ZeroInitT = ZeroInit): Unit(ZeroInit) {} + constexpr /*implicit*/ Rad(ZeroInitT = ZeroInit) noexcept: Unit(ZeroInit) {} /** @brief Construct without initializing the contents */ /* MSVC 2015 can't handle {} here */ - explicit Rad(NoInitT): Unit(NoInit) {} + explicit Rad(NoInitT) noexcept: Unit(NoInit) {} /** @brief Construct from unitless type */ - constexpr explicit Rad(T value): Unit(value) {} - - /** @brief Copy constructor */ - constexpr /*implicit*/ Rad(Unit value): Unit(value) {} + constexpr explicit Rad(T value) noexcept: Unit(value) {} /** @brief Construct from another underlying type */ - template constexpr explicit Rad(Unit value): Unit(value) {} + template constexpr explicit Rad(Unit value) noexcept: Unit(value) {} + + /** @brief Copy constructor */ + constexpr /*implicit*/ Rad(Unit value) noexcept: Unit(value) {} /** * @brief Construct radians from degrees diff --git a/src/Magnum/Math/BoolVector.h b/src/Magnum/Math/BoolVector.h index 46cbf6ccc..c2dab37a6 100644 --- a/src/Magnum/Math/BoolVector.h +++ b/src/Magnum/Math/BoolVector.h @@ -80,10 +80,10 @@ template class BoolVector { }; /** @brief Construct zero-filled boolean vector */ - constexpr /*implicit*/ BoolVector(ZeroInitT = ZeroInit): _data{} {} + constexpr /*implicit*/ BoolVector(ZeroInitT = ZeroInit) noexcept: _data{} {} /** @brief Construct without initializing the contents */ - explicit BoolVector(NoInitT) {} + explicit BoolVector(NoInitT) noexcept {} /** * @brief Construct boolean vector from segment values @@ -91,20 +91,20 @@ template class BoolVector { * @param next Values for next Bbit segments */ #ifdef DOXYGEN_GENERATING_OUTPUT - template constexpr /*implicit*/ BoolVector(UnsignedByte first, T... next); + template constexpr /*implicit*/ BoolVector(UnsignedByte first, T... next) noexcept; #else - template::type> constexpr /*implicit*/ BoolVector(UnsignedByte first, T... next): _data{first, UnsignedByte(next)...} {} + template::type> constexpr /*implicit*/ BoolVector(UnsignedByte first, T... next) noexcept: _data{first, UnsignedByte(next)...} {} #endif /** @brief Construct boolean vector with one value for all fields */ #ifdef DOXYGEN_GENERATING_OUTPUT - inline explicit BoolVector(T value); + explicit BoolVector(T value) noexcept; #else - template::value && size != 1, bool>::type> constexpr explicit BoolVector(T value): BoolVector(typename Implementation::GenerateSequence::Type(), value ? FullSegmentMask : 0) {} + template::value && size != 1, bool>::type> constexpr explicit BoolVector(T value) noexcept: BoolVector(typename Implementation::GenerateSequence::Type(), value ? FullSegmentMask : 0) {} #endif /** @brief Copy constructor */ - constexpr BoolVector(const BoolVector&) = default; + constexpr /*implicit*/ BoolVector(const BoolVector&) noexcept = default; /** * @brief Raw data diff --git a/src/Magnum/Math/Color.h b/src/Magnum/Math/Color.h index 5edc72d3b..2d7094cec 100644 --- a/src/Magnum/Math/Color.h +++ b/src/Magnum/Math/Color.h @@ -254,7 +254,7 @@ template class Color3: public Vector3 { * * All components are set to zero. */ - constexpr /*implicit*/ Color3(ZeroInitT = ZeroInit) + constexpr /*implicit*/ Color3(ZeroInitT = ZeroInit) noexcept /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ @@ -263,7 +263,7 @@ template class Color3: public Vector3 { {} /** @copydoc Vector::Vector(NoInitT) */ - explicit Color3(NoInitT) + explicit Color3(NoInitT) noexcept /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ @@ -275,7 +275,7 @@ template class Color3: public Vector3 { * @brief Gray constructor * @param rgb RGB value */ - constexpr explicit Color3(T rgb): Vector3(rgb) {} + constexpr explicit Color3(T rgb) noexcept: Vector3(rgb) {} /** * @brief Constructor @@ -283,7 +283,7 @@ template class Color3: public Vector3 { * @param g G value * @param b B value */ - constexpr /*implicit*/ Color3(T r, T g, T b): Vector3(r, g, b) {} + constexpr /*implicit*/ Color3(T r, T g, T b) noexcept: Vector3(r, g, b) {} /** * @copydoc Vector::Vector(const Vector&) @@ -292,10 +292,10 @@ template class Color3: public Vector3 { * @ref normalize() and @ref denormalize() instead. * See class documentation for more information. */ - template constexpr explicit Color3(const Vector<3, U>& other): Vector3(other) {} + template constexpr explicit Color3(const Vector<3, U>& other) noexcept: Vector3(other) {} /** @brief Copy constructor */ - constexpr Color3(const Vector<3, T>& other): Vector3(other) {} + constexpr /*implicit*/ Color3(const Vector<3, T>& other) noexcept: Vector3(other) {} /** * @brief Convert to HSV @@ -449,10 +449,10 @@ class Color4: public Vector4 { * * All components are set to zero. */ - constexpr /*implicit*/ Color4(): Vector4(T(0), T(0), T(0), T(0)) {} + constexpr /*implicit*/ Color4() noexcept: Vector4(T(0), T(0), T(0), T(0)) {} /** @copydoc Vector::Vector(ZeroInitT) */ - constexpr explicit Color4(ZeroInitT) + constexpr explicit Color4(ZeroInitT) noexcept /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ @@ -461,7 +461,7 @@ class Color4: public Vector4 { {} /** @copydoc Vector::Vector(NoInitT) */ - explicit Color4(NoInitT) + explicit Color4(NoInitT) noexcept /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ @@ -474,7 +474,7 @@ class Color4: public Vector4 { * @param alpha Alpha value, defaults to `1.0` for floating-point types * and maximum positive value for integral types. */ - constexpr explicit Color4(T rgb, T alpha = Implementation::fullChannel()): Vector4(rgb, rgb, rgb, alpha) {} + constexpr explicit Color4(T rgb, T alpha = Implementation::fullChannel()) noexcept: Vector4(rgb, rgb, rgb, alpha) {} /** * @brief Constructor @@ -484,7 +484,7 @@ class Color4: public Vector4 { * @param a A value, defaults to `1.0` for floating-point types and * maximum positive value for integral types. */ - constexpr /*implicit*/ Color4(T r, T g, T b, T a = Implementation::fullChannel()): Vector4(r, g, b, a) {} + constexpr /*implicit*/ Color4(T r, T g, T b, T a = Implementation::fullChannel()) noexcept: Vector4(r, g, b, a) {} /** * @brief Constructor @@ -493,7 +493,7 @@ class Color4: public Vector4 { */ /* Not marked as explicit, because conversion from Color3 to Color4 is fairly common, nearly always with A set to 1 */ - constexpr /*implicit*/ Color4(const Vector3& rgb, T a = Implementation::fullChannel()): Vector4(rgb[0], rgb[1], rgb[2], a) {} + constexpr /*implicit*/ Color4(const Vector3& rgb, T a = Implementation::fullChannel()) noexcept: Vector4(rgb[0], rgb[1], rgb[2], a) {} /** * @copydoc Vector::Vector(const Vector&) @@ -502,10 +502,10 @@ class Color4: public Vector4 { * @ref normalize() and @ref denormalize() instead. * See @ref Color3 class documentation for more information. */ - template constexpr explicit Color4(const Vector<4, U>& other): Vector4(other) {} + template constexpr explicit Color4(const Vector<4, U>& other) noexcept: Vector4(other) {} /** @brief Copy constructor */ - constexpr Color4(const Vector<4, T>& other): Vector4(other) {} + constexpr /*implicit*/ Color4(const Vector<4, T>& other) noexcept: Vector4(other) {} /** @copydoc Color3::toHSV() */ constexpr HSV toHSV() const { diff --git a/src/Magnum/Math/Complex.h b/src/Magnum/Math/Complex.h index 880241970..4c6a89c42 100644 --- a/src/Magnum/Math/Complex.h +++ b/src/Magnum/Math/Complex.h @@ -142,13 +142,13 @@ template class Complex { * c = 1 + i0 * @f] */ - constexpr /*implicit*/ Complex(IdentityInitT = IdentityInit): _real(T(1)), _imaginary(T(0)) {} + constexpr /*implicit*/ Complex(IdentityInitT = IdentityInit) noexcept: _real(T(1)), _imaginary(T(0)) {} /** @brief Construct zero-initialized complex number */ - constexpr explicit Complex(ZeroInitT): _real{}, _imaginary{} {} + constexpr explicit Complex(ZeroInitT) noexcept: _real{}, _imaginary{} {} /** @brief Construct without initializing the contents */ - explicit Complex(NoInitT) {} + explicit Complex(NoInitT) noexcept {} /** * @brief Construct complex number from real and imaginary part @@ -157,7 +157,7 @@ template class Complex { * c = a + ib * @f] */ - constexpr /*implicit*/ Complex(T real, T imaginary): _real(real), _imaginary(imaginary) {} + constexpr /*implicit*/ Complex(T real, T imaginary) noexcept: _real(real), _imaginary(imaginary) {} /** * @brief Construct complex number from vector @@ -167,7 +167,7 @@ template class Complex { * @f] * @see @ref operator Vector2(), @ref transformVector() */ - constexpr explicit Complex(const Vector2& vector): _real(vector.x()), _imaginary(vector.y()) {} + constexpr explicit Complex(const Vector2& vector) noexcept: _real(vector.x()), _imaginary(vector.y()) {} /** * @brief Construct complex number from another of different type @@ -175,11 +175,14 @@ template class Complex { * Performs only default casting on the values, no rounding or anything * else. */ - template constexpr explicit Complex(const Complex& other): _real{T(other._real)}, _imaginary{T(other._imaginary)} {} + template constexpr explicit Complex(const Complex& other) noexcept: _real{T(other._real)}, _imaginary{T(other._imaginary)} {} /** @brief Construct complex number from external representation */ template::from(std::declval()))> constexpr explicit Complex(const U& other): Complex{Implementation::ComplexConverter::from(other)} {} + /** @brief Copy constructor */ + constexpr /*implicit*/ Complex(const Complex&) noexcept = default; + /** @brief Convert complex number to external representation */ template::to(std::declval>()))> constexpr explicit operator U() const { return Implementation::ComplexConverter::to(*this); diff --git a/src/Magnum/Math/Dual.h b/src/Magnum/Math/Dual.h index 5080c9b2d..da09c5757 100644 --- a/src/Magnum/Math/Dual.h +++ b/src/Magnum/Math/Dual.h @@ -57,15 +57,15 @@ template class Dual { * * Both parts are default-constructed. */ - constexpr /*implicit*/ Dual(): _real(), _dual() {} + constexpr /*implicit*/ Dual() noexcept: _real{}, _dual{} {} /** @brief Construct without initializing the contents */ #ifdef DOXYGEN_GENERATING_OUTPUT - explicit Dual(NoInitT); + explicit Dual(NoInitT) noexcept; #else /* MSVC 2015 can't handle {} instead of ::value */ - template::value>::type> Dual(NoInitT) {} - template::value>::type> Dual(NoInitT): _real{NoInit}, _dual{NoInit} {} + template::value>::type> explicit Dual(NoInitT) noexcept {} + template::value>::type> explicit Dual(NoInitT) noexcept: _real{NoInit}, _dual{NoInit} {} #endif /** @@ -75,7 +75,7 @@ template class Dual { * \hat a = a_0 + \epsilon a_\epsilon * @f] */ - constexpr /*implicit*/ Dual(const T& real, const T& dual = T()): _real(real), _dual(dual) {} + constexpr /*implicit*/ Dual(const T& real, const T& dual = T()) noexcept: _real(real), _dual(dual) {} /** * @brief Construct dual number from another of different type @@ -88,7 +88,10 @@ template class Dual { * // integral == {1, 2} * @endcode */ - template constexpr explicit Dual(const Dual& other): _real{T(other._real)}, _dual{T(other._dual)} {} + template constexpr explicit Dual(const Dual& other) noexcept: _real{T(other._real)}, _dual{T(other._dual)} {} + + /** @brief Copy constructor */ + constexpr /*implicit*/ Dual(const Dual&) noexcept = default; /** @brief Equality comparison */ bool operator==(const Dual& other) const { diff --git a/src/Magnum/Math/DualComplex.h b/src/Magnum/Math/DualComplex.h index f32876935..f1a5df321 100644 --- a/src/Magnum/Math/DualComplex.h +++ b/src/Magnum/Math/DualComplex.h @@ -104,13 +104,13 @@ template class DualComplex: public Dual> { * @f] */ #ifdef DOXYGEN_GENERATING_OUTPUT - constexpr /*implicit*/ DualComplex(IdentityInitT = IdentityInit); + constexpr /*implicit*/ DualComplex(IdentityInitT = IdentityInit) noexcept; #else - constexpr /*implicit*/ DualComplex(IdentityInitT = IdentityInit): Dual>({}, {T(0), T(0)}) {} + constexpr /*implicit*/ DualComplex(IdentityInitT = IdentityInit) noexcept: Dual>({}, {T(0), T(0)}) {} #endif /** @brief Construct zero-initialized dual complex number */ - constexpr explicit DualComplex(ZeroInitT) + constexpr explicit DualComplex(ZeroInitT) noexcept /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ @@ -119,7 +119,7 @@ template class DualComplex: public Dual> { {} /** @brief Construct without initializing the contents */ - explicit DualComplex(NoInitT) + explicit DualComplex(NoInitT) noexcept /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ @@ -134,7 +134,7 @@ template class DualComplex: public Dual> { * \hat c = c_0 + \epsilon c_\epsilon * @f] */ - constexpr /*implicit*/ DualComplex(const Complex& real, const Complex& dual = Complex(T(0), T(0))): Dual>(real, dual) {} + constexpr /*implicit*/ DualComplex(const Complex& real, const Complex& dual = Complex(T(0), T(0))) noexcept: Dual>(real, dual) {} /** * @brief Construct dual complex number from vector @@ -144,9 +144,9 @@ template class DualComplex: public Dual> { * @f] */ #ifdef DOXYGEN_GENERATING_OUTPUT - constexpr explicit DualComplex(const Vector2& vector); + constexpr explicit DualComplex(const Vector2& vector) noexcept; #else - constexpr explicit DualComplex(const Vector2& vector): Dual>({}, Complex(vector)) {} + constexpr explicit DualComplex(const Vector2& vector) noexcept: Dual>({}, Complex(vector)) {} #endif /** @@ -155,7 +155,7 @@ template class DualComplex: public Dual> { * Performs only default casting on the values, no rounding or anything * else. */ - template constexpr explicit DualComplex(const DualComplex& other) + template constexpr explicit DualComplex(const DualComplex& other) noexcept #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ : Dual>(other) @@ -166,7 +166,7 @@ template class DualComplex: public Dual> { template::from(std::declval()))> constexpr explicit DualComplex(const U& other): DualComplex{Implementation::DualComplexConverter::from(other)} {} /** @brief Copy constructor */ - constexpr DualComplex(const Dual>& other): Dual>(other) {} + constexpr /*implicit*/ DualComplex(const Dual>& other) noexcept: Dual>(other) {} /** @brief Convert dual complex number to external representation */ template::to(std::declval>()))> constexpr explicit operator U() const { diff --git a/src/Magnum/Math/DualQuaternion.h b/src/Magnum/Math/DualQuaternion.h index 361754515..d4b6d35d3 100644 --- a/src/Magnum/Math/DualQuaternion.h +++ b/src/Magnum/Math/DualQuaternion.h @@ -163,7 +163,7 @@ template class DualQuaternion: public Dual> { * \hat q = [\boldsymbol 0, 1] + \epsilon [\boldsymbol 0, 0] * @f] */ - constexpr /*implicit*/ DualQuaternion(IdentityInitT = IdentityInit) + constexpr /*implicit*/ DualQuaternion(IdentityInitT = IdentityInit) noexcept /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT : Dual>({}, {{}, T(0)}) @@ -171,7 +171,7 @@ template class DualQuaternion: public Dual> { {} /** @brief Construct zero-initialized dual quaternion */ - constexpr explicit DualQuaternion(ZeroInitT) + constexpr explicit DualQuaternion(ZeroInitT) noexcept /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ @@ -180,7 +180,7 @@ template class DualQuaternion: public Dual> { {} /** @brief Construct without initializing the contents */ - explicit DualQuaternion(NoInitT) + explicit DualQuaternion(NoInitT) noexcept /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ @@ -195,7 +195,7 @@ template class DualQuaternion: public Dual> { * \hat q = q_0 + \epsilon q_\epsilon * @f] */ - constexpr /*implicit*/ DualQuaternion(const Quaternion& real, const Quaternion& dual = Quaternion({}, T(0))): Dual>(real, dual) {} + constexpr /*implicit*/ DualQuaternion(const Quaternion& real, const Quaternion& dual = Quaternion({}, T(0))) noexcept: Dual>(real, dual) {} /** * @brief Construct dual quaternion from dual vector and scalar parts @@ -204,7 +204,7 @@ template class DualQuaternion: public Dual> { * \hat q = [\hat{\boldsymbol v}, \hat s] = [\boldsymbol v_0, s_0] + \epsilon [\boldsymbol v_\epsilon, s_\epsilon] * @f] */ - constexpr /*implicit*/ DualQuaternion(const Dual>& vector, const Dual& scalar) + constexpr /*implicit*/ DualQuaternion(const Dual>& vector, const Dual& scalar) noexcept #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ : Dual>({vector.real(), scalar.real()}, {vector.dual(), scalar.dual()}) @@ -220,9 +220,9 @@ template class DualQuaternion: public Dual> { * @see @ref transformPointNormalized() */ #ifdef DOXYGEN_GENERATING_OUTPUT - constexpr explicit DualQuaternion(const Vector3& vector); + constexpr explicit DualQuaternion(const Vector3& vector) noexcept; #else - constexpr explicit DualQuaternion(const Vector3& vector): Dual>({}, {vector, T(0)}) {} + constexpr explicit DualQuaternion(const Vector3& vector) noexcept: Dual>({}, {vector, T(0)}) {} #endif /** @@ -231,13 +231,13 @@ template class DualQuaternion: public Dual> { * Performs only default casting on the values, no rounding or anything * else. */ - template constexpr explicit DualQuaternion(const DualQuaternion& other): Dual>(other) {} + template constexpr explicit DualQuaternion(const DualQuaternion& other) noexcept: Dual>(other) {} /** @brief Construct dual quaternion from external representation */ template::from(std::declval()))> constexpr explicit DualQuaternion(const U& other): DualQuaternion{Implementation::DualQuaternionConverter::from(other)} {} /** @brief Copy constructor */ - constexpr DualQuaternion(const Dual>& other): Dual>(other) {} + constexpr /*implicit*/ DualQuaternion(const Dual>& other) noexcept: Dual>(other) {} /** @brief Convert dual quaternion to external representation */ template::to(std::declval>()))> constexpr explicit operator U() const { diff --git a/src/Magnum/Math/Matrix.h b/src/Magnum/Math/Matrix.h index 6be18b9fd..b34c7ed90 100644 --- a/src/Magnum/Math/Matrix.h +++ b/src/Magnum/Math/Matrix.h @@ -83,7 +83,7 @@ template class Matrix: public RectangularMatrix class Matrix: public RectangularMatrix class Matrix: public RectangularMatrix class Matrix: public RectangularMatrix constexpr /*implicit*/ Matrix(const Vector& first, const U&... next): RectangularMatrix(first, next...) {} + template constexpr /*implicit*/ Matrix(const Vector& first, const U&... next) noexcept: RectangularMatrix(first, next...) {} /** * @brief Construct matrix from another of different type @@ -128,13 +128,13 @@ template class Matrix: public RectangularMatrix constexpr explicit Matrix(const RectangularMatrix& other): RectangularMatrix(other) {} + template constexpr explicit Matrix(const RectangularMatrix& other) noexcept: RectangularMatrix(other) {} /** @brief Construct matrix from external representation */ template::from(std::declval()))> constexpr explicit Matrix(const U& other): RectangularMatrix(Implementation::RectangularMatrixConverter::from(other)) {} /** @brief Copy constructor */ - constexpr Matrix(const RectangularMatrix& other): RectangularMatrix(other) {} + constexpr /*implicit*/ Matrix(const RectangularMatrix& other) noexcept: RectangularMatrix(other) {} /** * @brief Whether the matrix is orthogonal diff --git a/src/Magnum/Math/Matrix3.h b/src/Magnum/Math/Matrix3.h index 0906b4be4..be1eaa376 100644 --- a/src/Magnum/Math/Matrix3.h +++ b/src/Magnum/Math/Matrix3.h @@ -159,7 +159,7 @@ template class Matrix3: public Matrix3x3 { * Creates identity matrix. @p value allows you to specify value on * diagonal. */ - constexpr /*implicit*/ Matrix3(IdentityInitT = IdentityInit, T value = T{1}) + constexpr /*implicit*/ Matrix3(IdentityInitT = IdentityInit, T value = T{1}) noexcept /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ @@ -168,7 +168,7 @@ template class Matrix3: public Matrix3x3 { {} /** @copydoc Matrix::Matrix(ZeroInitT) */ - constexpr explicit Matrix3(ZeroInitT) + constexpr explicit Matrix3(ZeroInitT) noexcept /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ @@ -177,7 +177,7 @@ template class Matrix3: public Matrix3x3 { {} /** @copydoc Matrix::Matrix(NoInitT) */ - constexpr explicit Matrix3(NoInitT) + constexpr explicit Matrix3(NoInitT) noexcept /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ @@ -186,16 +186,16 @@ template class Matrix3: public Matrix3x3 { {} /** @brief Matrix from column vectors */ - constexpr /*implicit*/ Matrix3(const Vector3& first, const Vector3& second, const Vector3& third): Matrix3x3(first, second, third) {} + constexpr /*implicit*/ Matrix3(const Vector3& first, const Vector3& second, const Vector3& third) noexcept: Matrix3x3(first, second, third) {} /** @copydoc Matrix::Matrix(const RectangularMatrix&) */ - template constexpr explicit Matrix3(const RectangularMatrix<3, 3, U>& other): Matrix3x3(other) {} + template constexpr explicit Matrix3(const RectangularMatrix<3, 3, U>& other) noexcept: Matrix3x3(other) {} /** @brief Construct matrix from external representation */ - template::from(std::declval()))> constexpr explicit Matrix3(const U& other): Matrix3x3(Implementation::RectangularMatrixConverter<3, 3, T, U>::from(other)) {} + template::from(std::declval()))> constexpr explicit Matrix3(const U& other) noexcept: Matrix3x3(Implementation::RectangularMatrixConverter<3, 3, T, U>::from(other)) {} /** @brief Copy constructor */ - constexpr Matrix3(const RectangularMatrix<3, 3, T>& other): Matrix3x3(other) {} + constexpr /*implicit*/ Matrix3(const RectangularMatrix<3, 3, T>& other) noexcept: Matrix3x3(other) {} /** * @brief Check whether the matrix represents rigid transformation diff --git a/src/Magnum/Math/Matrix4.h b/src/Magnum/Math/Matrix4.h index 9f391399e..d3ee65716 100644 --- a/src/Magnum/Math/Matrix4.h +++ b/src/Magnum/Math/Matrix4.h @@ -255,7 +255,7 @@ template class Matrix4: public Matrix4x4 { * Creates identity matrix. @p value allows you to specify value on * diagonal. */ - constexpr /*implicit*/ Matrix4(IdentityInitT = IdentityInit, T value = T{1}) + constexpr /*implicit*/ Matrix4(IdentityInitT = IdentityInit, T value = T{1}) noexcept /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ @@ -264,7 +264,7 @@ template class Matrix4: public Matrix4x4 { {} /** @copydoc Matrix::Matrix(ZeroInitT) */ - constexpr explicit Matrix4(ZeroInitT) + constexpr explicit Matrix4(ZeroInitT) noexcept /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ @@ -273,7 +273,7 @@ template class Matrix4: public Matrix4x4 { {} /** @copydoc Matrix::Matrix(NoInitT) */ - constexpr explicit Matrix4(NoInitT) + constexpr explicit Matrix4(NoInitT) noexcept /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ @@ -282,16 +282,16 @@ template class Matrix4: public Matrix4x4 { {} /** @brief Matrix from column vectors */ - constexpr /*implicit*/ Matrix4(const Vector4& first, const Vector4& second, const Vector4& third, const Vector4& fourth): Matrix4x4(first, second, third, fourth) {} + constexpr /*implicit*/ Matrix4(const Vector4& first, const Vector4& second, const Vector4& third, const Vector4& fourth) noexcept: Matrix4x4(first, second, third, fourth) {} /** @copydoc Matrix::Matrix(const RectangularMatrix&) */ - template constexpr explicit Matrix4(const RectangularMatrix<4, 4, U>& other): Matrix4x4(other) {} + template constexpr explicit Matrix4(const RectangularMatrix<4, 4, U>& other) noexcept: Matrix4x4(other) {} /** @brief Construct matrix from external representation */ template::from(std::declval()))> constexpr explicit Matrix4(const U& other): Matrix4x4(Implementation::RectangularMatrixConverter<4, 4, T, U>::from(other)) {} /** @brief Copy constructor */ - constexpr Matrix4(const RectangularMatrix<4, 4, T>& other): Matrix4x4(other) {} + constexpr /*implicit*/ Matrix4(const RectangularMatrix<4, 4, T>& other) noexcept: Matrix4x4(other) {} /** * @brief Check whether the matrix represents rigid transformation diff --git a/src/Magnum/Math/Quaternion.h b/src/Magnum/Math/Quaternion.h index 82db72876..290949e14 100644 --- a/src/Magnum/Math/Quaternion.h +++ b/src/Magnum/Math/Quaternion.h @@ -205,13 +205,13 @@ template class Quaternion { * q = [\boldsymbol 0, 1] * @f] */ - constexpr /*implicit*/ Quaternion(IdentityInitT = IdentityInit): _scalar{T(1)} {} + constexpr /*implicit*/ Quaternion(IdentityInitT = IdentityInit) noexcept: _scalar{T(1)} {} /** @brief Construct zero-initialized quaternion */ - constexpr explicit Quaternion(ZeroInitT): _vector{ZeroInit}, _scalar{T{0}} {} + constexpr explicit Quaternion(ZeroInitT) noexcept: _vector{ZeroInit}, _scalar{T{0}} {} /** @brief Construct without initializing the contents */ - explicit Quaternion(NoInitT): _vector{NoInit} {} + explicit Quaternion(NoInitT) noexcept: _vector{NoInit} {} /** * @brief Construct quaternion from vector and scalar @@ -220,7 +220,7 @@ template class Quaternion { * q = [\boldsymbol v, s] * @f] */ - constexpr /*implicit*/ Quaternion(const Vector3& vector, T scalar): _vector(vector), _scalar(scalar) {} + constexpr /*implicit*/ Quaternion(const Vector3& vector, T scalar) noexcept: _vector(vector), _scalar(scalar) {} /** * @brief Construct quaternion from vector @@ -230,7 +230,7 @@ template class Quaternion { * @f] * @see @ref transformVector(), @ref transformVectorNormalized() */ - constexpr explicit Quaternion(const Vector3& vector): _vector(vector), _scalar(T(0)) {} + constexpr explicit Quaternion(const Vector3& vector) noexcept: _vector(vector), _scalar(T(0)) {} /** * @brief Construct dual complex number from another of different type @@ -238,11 +238,14 @@ template class Quaternion { * Performs only default casting on the values, no rounding or anything * else. */ - template constexpr explicit Quaternion(const Quaternion& other): _vector{other._vector}, _scalar{T(other._scalar)} {} + template constexpr explicit Quaternion(const Quaternion& other) noexcept: _vector{other._vector}, _scalar{T(other._scalar)} {} /** @brief Construct quaternion from external representation */ template::from(std::declval()))> constexpr explicit Quaternion(const U& other): Quaternion{Implementation::QuaternionConverter::from(other)} {} + /** @brief Copy constructor */ + constexpr /*implicit*/ Quaternion(const Quaternion&) noexcept = default; + /** @brief Convert quaternion to external representation */ template::to(std::declval>()))> constexpr explicit operator U() const { return Implementation::QuaternionConverter::to(*this); diff --git a/src/Magnum/Math/Range.h b/src/Magnum/Math/Range.h index 78a8fb195..ceefa56da 100644 --- a/src/Magnum/Math/Range.h +++ b/src/Magnum/Math/Range.h @@ -76,16 +76,13 @@ template class Range { * * Construct zero-size range positioned at origin. */ - constexpr /*implicit*/ Range(ZeroInitT = ZeroInit): _min{ZeroInit}, _max{ZeroInit} {} + constexpr /*implicit*/ Range(ZeroInitT = ZeroInit) noexcept: _min{ZeroInit}, _max{ZeroInit} {} /** @brief Construct without initializing the contents */ - explicit Range(NoInitT): _min{NoInit}, _max{NoInit} {} + explicit Range(NoInitT) noexcept: _min{NoInit}, _max{NoInit} {} /** @brief Construct range from minimal and maximal coordinates */ - constexpr /*implicit*/ Range(const VectorType& min, const VectorType& max): _min{min}, _max{max} {} - - /** @brief Copy constructor */ - constexpr Range(const Range&) = default; + constexpr /*implicit*/ Range(const VectorType& min, const VectorType& max) noexcept: _min{min}, _max{max} {} /** * @brief Construct range from another of different type @@ -97,11 +94,14 @@ template class Range { * Range2D integral(floatingPoint); // {{1, 2}, {-15, 7}} * @endcode */ - template constexpr explicit Range(const Range& other): _min(other._min), _max(other._max) {} + template constexpr explicit Range(const Range& other) noexcept: _min(other._min), _max(other._max) {} /** @brief Construct range from external representation */ template::from(std::declval()))> constexpr explicit Range(const U& other): Range{Implementation::RangeConverter::from(other)} {} + /** @brief Copy constructor */ + constexpr /*implicit*/ Range(const Range&) noexcept = default; + /** @brief Convert range to external representation */ template::to(std::declval>()))> constexpr explicit operator U() const { return Implementation::RangeConverter::to(*this); @@ -230,7 +230,7 @@ See @ref Range for more information. template class Range2D: public Range<2, T> { public: /** @copydoc Range(ZeroInitT) */ - constexpr /*implicit*/ Range2D(ZeroInitT = ZeroInit) + constexpr /*implicit*/ Range2D(ZeroInitT = ZeroInit) noexcept /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ @@ -239,7 +239,7 @@ template class Range2D: public Range<2, T> { {} /** @copydoc Range(NoInitT) */ - explicit Range2D(NoInitT) + explicit Range2D(NoInitT) noexcept /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ @@ -248,13 +248,10 @@ template class Range2D: public Range<2, T> { {} /** @copydoc Range(const VectorType&, const VectorType&) */ - constexpr /*implicit*/ Range2D(const Vector2& min, const Vector2& max): Range<2, T>(min, max) {} - - /** @copydoc Range(const Range&) */ - constexpr /*implicit*/ Range2D(const Range<2, T>& other): Range<2, T>(other) {} + constexpr /*implicit*/ Range2D(const Vector2& min, const Vector2& max) noexcept: Range<2, T>(min, max) {} /** @copydoc Range(const Range&) */ - template constexpr explicit Range2D(const Range2D& other): Range<2, T>(other) {} + template constexpr explicit Range2D(const Range2D& other) noexcept: Range<2, T>(other) {} /** * @brief Construct range from external representation @@ -274,6 +271,9 @@ template class Range2D: public Range<2, T> { #endif {} + /** @copydoc Range(const Range&) */ + constexpr /*implicit*/ Range2D(const Range<2, T>& other) noexcept: Range<2, T>(other) {} + /** * @brief Bottom left corner * @@ -364,7 +364,7 @@ See @ref Range for more information. template class Range3D: public Range<3, T> { public: /** @copydoc Range(ZeroInitT) */ - constexpr /*implicit*/ Range3D(ZeroInitT = ZeroInit) + constexpr /*implicit*/ Range3D(ZeroInitT = ZeroInit) noexcept /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ @@ -373,7 +373,7 @@ template class Range3D: public Range<3, T> { {} /** @copybrief Range(NoInitT) */ - explicit Range3D(NoInitT) + explicit Range3D(NoInitT) noexcept /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ @@ -382,25 +382,25 @@ template class Range3D: public Range<3, T> { {} /** @copydoc Range(const VectorType&, const VectorType&) */ - constexpr /*implicit*/ Range3D(const Vector3& min, const Vector3& max): Range<3, T>(min, max) {} - - /** @copydoc Range(const Range&) */ - constexpr /*implicit*/ Range3D(const Range<3, T>& other): Range<3, T>(other) {} + constexpr /*implicit*/ Range3D(const Vector3& min, const Vector3& max) noexcept: Range<3, T>(min, max) {} /** @copydoc Range(const Range&) */ - template constexpr explicit Range3D(const Range3D& other): Range<3, T>(other) {} + template constexpr explicit Range3D(const Range3D& other) noexcept: Range<3, T>(other) {} /** * @brief Construct range from external representation * @todoc Remove workaround when Doxygen no longer chokes on that line */ - template::from(std::declval()))> constexpr explicit Range3D(const U& other) + template::from(std::declval()))> constexpr explicit Range3D(const U& other) noexcept #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ : Range<3, T>(Implementation::RangeConverter<3, T, U>::from(other)) #endif {} + /** @copydoc Range(const Range&) */ + constexpr /*implicit*/ Range3D(const Range<3, T>& other) noexcept: Range<3, T>(other) {} + /** * @brief Back bottom left corner * diff --git a/src/Magnum/Math/RectangularMatrix.h b/src/Magnum/Math/RectangularMatrix.h index 9e9d6a594..76b8d67e0 100644 --- a/src/Magnum/Math/RectangularMatrix.h +++ b/src/Magnum/Math/RectangularMatrix.h @@ -103,12 +103,12 @@ template class RectangularMatrix { * * @see @ref diagonal() */ - constexpr static RectangularMatrix fromDiagonal(const Vector& diagonal) { + constexpr static RectangularMatrix fromDiagonal(const Vector& diagonal) noexcept { return RectangularMatrix(typename Implementation::GenerateSequence::Type(), diagonal); } /** @brief Construct zero-filled matrix */ - constexpr /*implicit*/ RectangularMatrix(ZeroInitT = ZeroInit) + constexpr /*implicit*/ RectangularMatrix(ZeroInitT = ZeroInit) noexcept /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ @@ -117,7 +117,7 @@ template class RectangularMatrix { {} /** @brief Construct matrix without initializing the contents */ - explicit RectangularMatrix(NoInitT) + explicit RectangularMatrix(NoInitT) noexcept /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ @@ -132,7 +132,7 @@ template class RectangularMatrix { * * @todo Creating matrix from arbitrary combination of matrices with n rows */ - template constexpr /*implicit*/ RectangularMatrix(const Vector& first, const U&... next): _data{first, next...} { + template constexpr /*implicit*/ RectangularMatrix(const Vector& first, const U&... next) noexcept: _data{first, next...} { static_assert(sizeof...(next)+1 == cols, "Improper number of arguments passed to RectangularMatrix constructor"); } @@ -147,13 +147,13 @@ template class RectangularMatrix { * // integral == {1, 2, -15, 7} * @endcode */ - template constexpr explicit RectangularMatrix(const RectangularMatrix& other): RectangularMatrix(typename Implementation::GenerateSequence::Type(), other) {} + template constexpr explicit RectangularMatrix(const RectangularMatrix& other) noexcept: RectangularMatrix(typename Implementation::GenerateSequence::Type(), other) {} /** @brief Construct matrix from external representation */ template::from(std::declval()))> constexpr explicit RectangularMatrix(const U& other): RectangularMatrix(Implementation::RectangularMatrixConverter::from(other)) {} /** @brief Copy constructor */ - constexpr RectangularMatrix(const RectangularMatrix&) = default; + constexpr /*implicit*/ RectangularMatrix(const RectangularMatrix&) noexcept = default; /** @brief Convert matrix to external representation */ template::to(std::declval>()))> constexpr explicit operator U() const { @@ -393,11 +393,11 @@ template class RectangularMatrix { private: /* Implementation for RectangularMatrix::RectangularMatrix(const RectangularMatrix&) */ - template constexpr explicit RectangularMatrix(Implementation::Sequence, const RectangularMatrix& matrix): _data{Vector(matrix[sequence])...} {} + template constexpr explicit RectangularMatrix(Implementation::Sequence, const RectangularMatrix& matrix) noexcept: _data{Vector(matrix[sequence])...} {} /* Implementation for RectangularMatrix::RectangularMatrix(ZeroInitT) and RectangularMatrix::RectangularMatrix(NoInitT) */ /* MSVC 2015 can't handle {} here */ - template constexpr explicit RectangularMatrix(Implementation::Sequence, U): _data{Vector((static_cast(sequence), U{typename U::Init{}}))...} {} + template constexpr explicit RectangularMatrix(Implementation::Sequence, U) noexcept: _data{Vector((static_cast(sequence), U{typename U::Init{}}))...} {} template constexpr RectangularMatrix flippedColsInternal(Implementation::Sequence) const { return {(*this)[sequence]...}; diff --git a/src/Magnum/Math/Test/AngleTest.cpp b/src/Magnum/Math/Test/AngleTest.cpp index 64a8877a5..5cc6056be 100644 --- a/src/Magnum/Math/Test/AngleTest.cpp +++ b/src/Magnum/Math/Test/AngleTest.cpp @@ -79,6 +79,9 @@ void AngleTest::construct() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); CORRADE_VERIFY(!(std::is_convertible::value)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void AngleTest::constructDefault() { @@ -90,6 +93,11 @@ void AngleTest::constructDefault() { constexpr Radd a2{ZeroInit}; CORRADE_COMPARE(Double(a1), 0.0); CORRADE_COMPARE(Double(a2), 0.0); + + CORRADE_VERIFY(std::is_nothrow_default_constructible::value); + CORRADE_VERIFY(std::is_nothrow_default_constructible::value); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void AngleTest::constructNoInit() { @@ -99,6 +107,9 @@ void AngleTest::constructNoInit() { new(&b) Rad{NoInit}; CORRADE_COMPARE(Float(a), 25.0f); CORRADE_COMPARE(Float(b), 3.14f); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void AngleTest::constructConversion() { @@ -113,6 +124,9 @@ void AngleTest::constructConversion() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); CORRADE_VERIFY(!(std::is_convertible::value)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void AngleTest::constructCopy() { @@ -123,6 +137,11 @@ void AngleTest::constructCopy() { CORRADE_COMPARE(c, a); constexpr Radd d(b); CORRADE_COMPARE(d, b); + + CORRADE_VERIFY(std::is_nothrow_copy_constructible::value); + CORRADE_VERIFY(std::is_nothrow_copy_constructible::value); + CORRADE_VERIFY(std::is_nothrow_copy_assignable::value); + CORRADE_VERIFY(std::is_nothrow_copy_assignable::value); } void AngleTest::literals() { diff --git a/src/Magnum/Math/Test/BoolVectorTest.cpp b/src/Magnum/Math/Test/BoolVectorTest.cpp index 4a6d8c78d..a380b34f8 100644 --- a/src/Magnum/Math/Test/BoolVectorTest.cpp +++ b/src/Magnum/Math/Test/BoolVectorTest.cpp @@ -83,6 +83,8 @@ BoolVectorTest::BoolVectorTest() { void BoolVectorTest::construct() { constexpr BoolVector19 a = {0xa5, 0x5f, 0x07}; CORRADE_COMPARE(a, BoolVector19(0xa5, 0x5f, 0x07)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void BoolVectorTest::constructDefault() { @@ -90,12 +92,17 @@ void BoolVectorTest::constructDefault() { constexpr BoolVector19 b{ZeroInit}; CORRADE_COMPARE(a, BoolVector19(0x00, 0x00, 0x00)); CORRADE_COMPARE(b, BoolVector19(0x00, 0x00, 0x00)); + + CORRADE_VERIFY(std::is_nothrow_default_constructible::value); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void BoolVectorTest::constructNoInit() { BoolVector19 a{0xa5, 0x5f, 0x07}; new(&a) BoolVector19{NoInit}; CORRADE_COMPARE(a, BoolVector19(0xa5, 0x5f, 0x07)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void BoolVectorTest::constructOneValue() { @@ -106,6 +113,8 @@ void BoolVectorTest::constructOneValue() { CORRADE_COMPARE(b, BoolVector19(0xff, 0xff, 0x07)); CORRADE_VERIFY(!(std::is_convertible::value)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void BoolVectorTest::constructOneElement() { @@ -113,12 +122,17 @@ void BoolVectorTest::constructOneElement() { constexpr BoolVector1 a = 0x01; CORRADE_COMPARE(a, BoolVector1(0x01)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void BoolVectorTest::constructCopy() { constexpr BoolVector19 a = {0xa5, 0x5f, 0x07}; constexpr BoolVector19 b(a); CORRADE_COMPARE(b, BoolVector19(0xa5, 0x5f, 0x07)); + + CORRADE_VERIFY(std::is_nothrow_copy_constructible::value); + CORRADE_VERIFY(std::is_nothrow_copy_assignable::value); } void BoolVectorTest::data() { diff --git a/src/Magnum/Math/Test/ColorTest.cpp b/src/Magnum/Math/Test/ColorTest.cpp index 10871e926..85fef7b08 100644 --- a/src/Magnum/Math/Test/ColorTest.cpp +++ b/src/Magnum/Math/Test/ColorTest.cpp @@ -119,6 +119,9 @@ void ColorTest::construct() { constexpr Color4ub d = {10, 25, 176}; CORRADE_COMPARE(c, Vector4(1.0f, 0.5f, 0.75f, 1.0f)); CORRADE_COMPARE(d, Math::Vector4(10, 25, 176, 255)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void ColorTest::constructDefault() { @@ -134,6 +137,11 @@ void ColorTest::constructDefault() { constexpr Color4ub c; CORRADE_COMPARE(c, Color4ub(0, 0, 0, 0)); + + CORRADE_VERIFY(std::is_nothrow_default_constructible::value); + CORRADE_VERIFY(std::is_nothrow_default_constructible::value); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void ColorTest::constructNoInit() { @@ -143,6 +151,9 @@ void ColorTest::constructNoInit() { new(&b) Color4{Math::NoInit}; CORRADE_COMPARE(a, (Color3{1.0f, 0.5f, 0.75f})); CORRADE_COMPARE(b, (Color4{1.0f, 0.5f, 0.75f, 0.5f})); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void ColorTest::constructOneValue() { @@ -161,6 +172,9 @@ void ColorTest::constructOneValue() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); CORRADE_VERIFY(!(std::is_convertible::value)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void ColorTest::constructParts() { @@ -175,6 +189,8 @@ void ColorTest::constructParts() { constexpr Color4ub e = c; CORRADE_COMPARE(d, Color4(1.0f, 0.5f, 0.75f, 1.0f)); CORRADE_COMPARE(e, Color4ub(10, 25, 176, 255)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void ColorTest::constructConversion() { @@ -189,6 +205,9 @@ void ColorTest::constructConversion() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); CORRADE_VERIFY(!(std::is_convertible::value)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void ColorTest::constructNormalization() { @@ -215,6 +234,11 @@ void ColorTest::constructCopy() { #endif Color4 d(c); CORRADE_COMPARE(d, Color4(1.0f, 0.5f, 0.75f, 0.25f)); + + CORRADE_VERIFY(std::is_nothrow_copy_constructible::value); + CORRADE_VERIFY(std::is_nothrow_copy_constructible::value); + CORRADE_VERIFY(std::is_nothrow_copy_assignable::value); + CORRADE_VERIFY(std::is_nothrow_copy_assignable::value); } void ColorTest::literals() { diff --git a/src/Magnum/Math/Test/ComplexTest.cpp b/src/Magnum/Math/Test/ComplexTest.cpp index c24dff8d4..70e7c5862 100644 --- a/src/Magnum/Math/Test/ComplexTest.cpp +++ b/src/Magnum/Math/Test/ComplexTest.cpp @@ -141,6 +141,8 @@ void ComplexTest::construct() { constexpr Float c = a.imaginary(); CORRADE_COMPARE(b, 0.5f); CORRADE_COMPARE(c, -3.7f); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void ComplexTest::constructIdentity() { @@ -150,17 +152,24 @@ void ComplexTest::constructIdentity() { CORRADE_COMPARE(b, Complex(1.0f, 0.0f)); CORRADE_COMPARE(a.length(), 1.0f); CORRADE_COMPARE(b.length(), 1.0f); + + CORRADE_VERIFY(std::is_nothrow_default_constructible::value); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void ComplexTest::constructZero() { constexpr Complex a{ZeroInit}; CORRADE_COMPARE(a, Complex(0.0f, 0.0f)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void ComplexTest::constructNoInit() { Complex a{0.5f, -3.7f}; new(&a) Complex{NoInit}; CORRADE_COMPARE(a, Complex(0.5f, -3.7f)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void ComplexTest::constructFromVector() { @@ -175,6 +184,8 @@ void ComplexTest::constructFromVector() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); CORRADE_VERIFY(!(std::is_convertible::value)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void ComplexTest::constructConversion() { @@ -187,12 +198,17 @@ void ComplexTest::constructConversion() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void ComplexTest::constructCopy() { constexpr Complex a(2.5f, -5.0f); constexpr Complex b(a); CORRADE_COMPARE(b, Complex(2.5f, -5.0f)); + + CORRADE_VERIFY(std::is_nothrow_copy_constructible::value); + CORRADE_VERIFY(std::is_nothrow_copy_assignable::value); } void ComplexTest::convert() { diff --git a/src/Magnum/Math/Test/DualComplexTest.cpp b/src/Magnum/Math/Test/DualComplexTest.cpp index 892f9d36c..f077bb0e8 100644 --- a/src/Magnum/Math/Test/DualComplexTest.cpp +++ b/src/Magnum/Math/Test/DualComplexTest.cpp @@ -141,6 +141,8 @@ void DualComplexTest::construct() { constexpr DualComplex d(Complex(-1.0f, 2.5f)); CORRADE_COMPARE(d, DualComplex({-1.0f, 2.5f}, {0.0f, 0.0f})); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void DualComplexTest::constructIdentity() { @@ -150,17 +152,24 @@ void DualComplexTest::constructIdentity() { CORRADE_COMPARE(b, DualComplex({1.0f, 0.0f}, {0.0f, 0.0f})); CORRADE_COMPARE(a.length(), 1.0f); CORRADE_COMPARE(b.length(), 1.0f); + + CORRADE_VERIFY(std::is_nothrow_default_constructible::value); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void DualComplexTest::constructZero() { constexpr DualComplex a{ZeroInit}; CORRADE_COMPARE(a, DualComplex({0.0f, 0.0f}, {0.0f, 0.0f})); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void DualComplexTest::constructNoInit() { DualComplex a{{-1.0f, 2.5f}, {3.0f, -7.5f}}; new(&a) DualComplex{NoInit}; CORRADE_COMPARE(a, DualComplex({-1.0f, 2.5f}, {3.0f, -7.5f})); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void DualComplexTest::constructFromVector() { @@ -169,6 +178,8 @@ void DualComplexTest::constructFromVector() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void DualComplexTest::constructConversion() { @@ -181,6 +192,8 @@ void DualComplexTest::constructConversion() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void DualComplexTest::constructCopy() { @@ -190,6 +203,9 @@ void DualComplexTest::constructCopy() { #endif DualComplex b(a); CORRADE_COMPARE(b, DualComplex({-1.0f, 2.5f}, {3.0f, -7.5f})); + + CORRADE_VERIFY(std::is_nothrow_copy_constructible::value); + CORRADE_VERIFY(std::is_nothrow_copy_assignable::value); } void DualComplexTest::convert() { diff --git a/src/Magnum/Math/Test/DualQuaternionTest.cpp b/src/Magnum/Math/Test/DualQuaternionTest.cpp index 7d8884026..a83535c10 100644 --- a/src/Magnum/Math/Test/DualQuaternionTest.cpp +++ b/src/Magnum/Math/Test/DualQuaternionTest.cpp @@ -150,6 +150,8 @@ void DualQuaternionTest::construct() { constexpr DualQuaternion d({{1.0f, 2.0f, 3.0f}, -4.0f}); CORRADE_COMPARE(d, DualQuaternion({{1.0f, 2.0f, 3.0f}, -4.0f}, {{0.0f, 0.0f, 0.0f}, 0.0f})); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void DualQuaternionTest::constructVectorScalar() { @@ -161,6 +163,8 @@ void DualQuaternionTest::constructVectorScalar() { constexpr Quaternion c = a.dual(); CORRADE_COMPARE(c, Quaternion({0.5f, -3.1f, 3.3f}, 2.0f)); + + CORRADE_VERIFY((std::is_nothrow_constructible, Math::Dual>::value)); } void DualQuaternionTest::constructIdentity() { @@ -170,17 +174,24 @@ void DualQuaternionTest::constructIdentity() { CORRADE_COMPARE(b, DualQuaternion({{0.0f, 0.0f, 0.0f}, 1.0f}, {{0.0f, 0.0f, 0.0f}, 0.0f})); CORRADE_COMPARE(a.length(), 1.0f); CORRADE_COMPARE(b.length(), 1.0f); + + CORRADE_VERIFY(std::is_nothrow_default_constructible::value); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void DualQuaternionTest::constructZero() { constexpr DualQuaternion a{ZeroInit}; CORRADE_COMPARE(a, DualQuaternion({{0.0f, 0.0f, 0.0f}, 0.0f}, {{0.0f, 0.0f, 0.0f}, 0.0f})); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void DualQuaternionTest::constructNoInit() { DualQuaternion a{{{1.0f, 2.0f, 3.0f}, -4.0f}, {{0.5f, -3.1f, 3.3f}, 2.0f}}; new(&a) DualQuaternion{NoInit}; CORRADE_COMPARE(a, DualQuaternion({{1.0f, 2.0f, 3.0f}, -4.0f}, {{0.5f, -3.1f, 3.3f}, 2.0f})); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void DualQuaternionTest::constructFromVector() { @@ -189,6 +200,8 @@ void DualQuaternionTest::constructFromVector() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void DualQuaternionTest::constructConversion() { @@ -201,6 +214,8 @@ void DualQuaternionTest::constructConversion() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void DualQuaternionTest::constructCopy() { @@ -210,6 +225,9 @@ void DualQuaternionTest::constructCopy() { #endif DualQuaternion b(a); CORRADE_COMPARE(b, DualQuaternion({{1.0f, 2.0f, -3.0f}, -3.5f}, {{4.5f, -7.0f, 2.0f}, 1.0f})); + + CORRADE_VERIFY(std::is_nothrow_copy_constructible::value); + CORRADE_VERIFY(std::is_nothrow_copy_assignable::value); } void DualQuaternionTest::convert() { diff --git a/src/Magnum/Math/Test/DualTest.cpp b/src/Magnum/Math/Test/DualTest.cpp index c99cebcbf..dbb5c4b44 100644 --- a/src/Magnum/Math/Test/DualTest.cpp +++ b/src/Magnum/Math/Test/DualTest.cpp @@ -27,6 +27,7 @@ #include #include "Magnum/Math/Dual.h" +#include "Magnum/Math/Quaternion.h" #include "Magnum/Math/Vector2.h" namespace Magnum { namespace Math { namespace Test { @@ -106,17 +107,29 @@ void DualTest::construct() { constexpr Dual d(3.0f); CORRADE_COMPARE(d.real(), 3.0f); CORRADE_COMPARE(d.dual(), 0.0f); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void DualTest::constructDefault() { constexpr Dual a; + constexpr Math::Dual> b; CORRADE_COMPARE(a, Dual(0.0f, 0.0f)); + CORRADE_COMPARE(b, Math::Dual>({{0.0f, 0.0f, 0.0f}, 1.0f}, {{0.0f, 0.0f, 0.0f}, 1.0f})); + + CORRADE_VERIFY(std::is_nothrow_default_constructible::value); } void DualTest::constructNoInit() { Dual a{2.0f, -7.5f}; + Math::Dual> b{{{3.0f, 0.1f, 1.0f}, 1.0f}, {{0.1f, 0.0f, 1.0f}, 0.3f}}; new(&a) Dual{NoInit}; + new(&b) Math::Dual>{NoInit}; CORRADE_COMPARE(a, Dual(2.0f, -7.5f)); + CORRADE_COMPARE(b, (Math::Dual>{{{3.0f, 0.1f, 1.0f}, 1.0f}, {{0.1f, 0.0f, 1.0f}, 0.3f}})); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); + CORRADE_VERIFY((std::is_nothrow_constructible>, NoInitT>::value)); } void DualTest::constructConversion() { @@ -129,12 +142,17 @@ void DualTest::constructConversion() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void DualTest::constructCopy() { constexpr Dual a(2.0f, 3.0f); constexpr Dual b(a); CORRADE_COMPARE(b, Dual(2.0f, 3.0f)); + + CORRADE_VERIFY(std::is_nothrow_copy_constructible::value); + CORRADE_VERIFY(std::is_nothrow_copy_assignable::value); } void DualTest::compare() { diff --git a/src/Magnum/Math/Test/Matrix3Test.cpp b/src/Magnum/Math/Test/Matrix3Test.cpp index be6d680e0..322181471 100644 --- a/src/Magnum/Math/Test/Matrix3Test.cpp +++ b/src/Magnum/Math/Test/Matrix3Test.cpp @@ -136,6 +136,8 @@ void Matrix3Test::construct() { CORRADE_COMPARE(a, Matrix3({3.0f, 5.0f, 8.0f}, {4.5f, 4.0f, 7.0f}, {7.9f, -1.0f, 8.0f})); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void Matrix3Test::constructIdentity() { @@ -154,6 +156,9 @@ void Matrix3Test::constructIdentity() { CORRADE_COMPARE(identity, identityExpected); CORRADE_COMPARE(identity2, identityExpected); CORRADE_COMPARE(identity3, identity3Expected); + + CORRADE_VERIFY(std::is_nothrow_default_constructible::value); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void Matrix3Test::constructZero() { @@ -161,6 +166,8 @@ void Matrix3Test::constructZero() { CORRADE_COMPARE(a, Matrix3({0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f})); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void Matrix3Test::constructNoInit() { @@ -171,6 +178,8 @@ void Matrix3Test::constructNoInit() { CORRADE_COMPARE(a, Matrix3({3.0f, 5.0f, 8.0f}, {4.5f, 4.0f, 7.0f}, {7.9f, -1.0f, 8.0f})); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void Matrix3Test::constructConversion() { @@ -184,6 +193,8 @@ void Matrix3Test::constructConversion() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void Matrix3Test::constructCopy() { @@ -197,6 +208,9 @@ void Matrix3Test::constructCopy() { CORRADE_COMPARE(b, Matrix3({3.0f, 5.0f, 8.0f}, {4.5f, 4.0f, 7.0f}, {7.9f, -1.0f, 8.0f})); + + CORRADE_VERIFY(std::is_nothrow_copy_constructible::value); + CORRADE_VERIFY(std::is_nothrow_copy_assignable::value); } void Matrix3Test::convert() { diff --git a/src/Magnum/Math/Test/Matrix4Test.cpp b/src/Magnum/Math/Test/Matrix4Test.cpp index 7d1bf5ae5..49e20cade 100644 --- a/src/Magnum/Math/Test/Matrix4Test.cpp +++ b/src/Magnum/Math/Test/Matrix4Test.cpp @@ -107,6 +107,7 @@ typedef Math::Matrix4 Matrix4; typedef Math::Matrix4 Matrix4i; typedef Math::Matrix<3, Float> Matrix3x3; typedef Math::Vector3 Vector3; +typedef Math::Vector4 Vector4; typedef Math::Constants Constants; Matrix4Test::Matrix4Test() { @@ -159,6 +160,8 @@ void Matrix4Test::construct() { {4.5f, 4.0f, 7.0f, 2.0f}, {1.0f, 2.0f, 3.0f, -1.0f}, {7.9f, -1.0f, 8.0f, -1.5f})); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void Matrix4Test::constructIdentity() { @@ -179,6 +182,9 @@ void Matrix4Test::constructIdentity() { CORRADE_COMPARE(identity, identityExpected); CORRADE_COMPARE(identity2, identityExpected); CORRADE_COMPARE(identity3, identity3Expected); + + CORRADE_VERIFY(std::is_nothrow_default_constructible::value); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void Matrix4Test::constructZero() { @@ -187,6 +193,8 @@ void Matrix4Test::constructZero() { {0.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 0.0f, 0.0f})); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void Matrix4Test::constructNoInit() { @@ -199,6 +207,8 @@ void Matrix4Test::constructNoInit() { {4.5f, 4.0f, 7.0f, 2.0f}, {1.0f, 2.0f, 3.0f, -1.0f}, {7.9f, -1.0f, 8.0f, -1.5f})); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void Matrix4Test::constructConversion() { @@ -214,6 +224,8 @@ void Matrix4Test::constructConversion() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void Matrix4Test::constructCopy() { @@ -229,6 +241,9 @@ void Matrix4Test::constructCopy() { {4.5f, 4.0f, 7.0f, 2.0f}, {1.0f, 2.0f, 3.0f, -1.0f}, {7.9f, -1.0f, 8.0f, -1.5f})); + + CORRADE_VERIFY(std::is_nothrow_copy_constructible::value); + CORRADE_VERIFY(std::is_nothrow_copy_assignable::value); } void Matrix4Test::convert() { diff --git a/src/Magnum/Math/Test/MatrixTest.cpp b/src/Magnum/Math/Test/MatrixTest.cpp index 7a216e220..8b124f0a7 100644 --- a/src/Magnum/Math/Test/MatrixTest.cpp +++ b/src/Magnum/Math/Test/MatrixTest.cpp @@ -123,6 +123,8 @@ void MatrixTest::construct() { Vector4(4.5f, 4.0f, 7.0f, 2.0f), Vector4(1.0f, 2.0f, 3.0f, -1.0f), Vector4(7.9f, -1.0f, 8.0f, -1.5f))); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void MatrixTest::constructIdentity() { @@ -143,6 +145,9 @@ void MatrixTest::constructIdentity() { CORRADE_COMPARE(identity, identityExpected); CORRADE_COMPARE(identity2, identityExpected); CORRADE_COMPARE(identity3, identity3Expected); + + CORRADE_VERIFY(std::is_nothrow_default_constructible::value); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void MatrixTest::constructZero() { @@ -151,6 +156,8 @@ void MatrixTest::constructZero() { Vector4(0.0f, 0.0f, 0.0f, 0.0f), Vector4(0.0f, 0.0f, 0.0f, 0.0f), Vector4(0.0f, 0.0f, 0.0f, 0.0f))); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void MatrixTest::constructNoInit() { @@ -163,6 +170,8 @@ void MatrixTest::constructNoInit() { Vector4(4.5f, 4.0f, 7.0f, 2.0f), Vector4(1.0f, 2.0f, 3.0f, -1.0f), Vector4(7.9f, -1.0f, 8.0f, -1.5f))); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void MatrixTest::constructConversion() { @@ -178,6 +187,8 @@ void MatrixTest::constructConversion() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void MatrixTest::constructCopy() { @@ -193,6 +204,9 @@ void MatrixTest::constructCopy() { Vector4(4.5f, 4.0f, 7.0f, 2.0f), Vector4(1.0f, 2.0f, 3.0f, -1.0f), Vector4(7.9f, -1.0f, 8.0f, -1.5f))); + + CORRADE_VERIFY(std::is_nothrow_copy_constructible::value); + CORRADE_VERIFY(std::is_nothrow_copy_assignable::value); } void MatrixTest::convert() { diff --git a/src/Magnum/Math/Test/QuaternionTest.cpp b/src/Magnum/Math/Test/QuaternionTest.cpp index 106c3a366..908dc7ac3 100644 --- a/src/Magnum/Math/Test/QuaternionTest.cpp +++ b/src/Magnum/Math/Test/QuaternionTest.cpp @@ -148,6 +148,8 @@ void QuaternionTest::construct() { constexpr Float c = a.scalar(); CORRADE_COMPARE(b, Vector3(1.0f, 2.0f, 3.0f)); CORRADE_COMPARE(c, -4.0f); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void QuaternionTest::constructIdentity() { @@ -157,17 +159,24 @@ void QuaternionTest::constructIdentity() { CORRADE_COMPARE(b, Quaternion({0.0f, 0.0f, 0.0f}, 1.0f)); CORRADE_COMPARE(a.length(), 1.0f); CORRADE_COMPARE(b.length(), 1.0f); + + CORRADE_VERIFY(std::is_nothrow_default_constructible::value); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void QuaternionTest::constructZero() { constexpr Quaternion a{ZeroInit}; CORRADE_COMPARE(a, Quaternion({0.0f, 0.0f, 0.0f}, 0.0f)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void QuaternionTest::constructNoInit() { Quaternion a{{1.0f, 2.0f, 3.0f}, -4.0f}; new(&a) Quaternion{NoInit}; CORRADE_COMPARE(a, Quaternion({1.0f, 2.0f, 3.0f}, -4.0f)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void QuaternionTest::constructFromVector() { @@ -176,6 +185,8 @@ void QuaternionTest::constructFromVector() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void QuaternionTest::constructConversion() { @@ -188,12 +199,17 @@ void QuaternionTest::constructConversion() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void QuaternionTest::constructCopy() { constexpr Quaternion a({1.0f, -3.0f, 7.0f}, 2.5f); constexpr Quaternion b(a); CORRADE_COMPARE(b, Quaternion({1.0f, -3.0f, 7.0f}, 2.5f)); + + CORRADE_VERIFY(std::is_nothrow_copy_constructible::value); + CORRADE_VERIFY(std::is_nothrow_copy_assignable::value); } void QuaternionTest::convert() { diff --git a/src/Magnum/Math/Test/RangeTest.cpp b/src/Magnum/Math/Test/RangeTest.cpp index a428f77d9..d1efadc7e 100644 --- a/src/Magnum/Math/Test/RangeTest.cpp +++ b/src/Magnum/Math/Test/RangeTest.cpp @@ -178,6 +178,10 @@ void RangeTest::construct() { CORRADE_COMPARE(a, (Range<1, Int>(3, 23))); CORRADE_COMPARE(b, (Range<2, Int>({3, 5}, {23, 78}))); CORRADE_COMPARE(c, (Range<3, Int>({3, 5, -7}, {23, 78, 2}))); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void RangeTest::constructDefault() { @@ -194,6 +198,13 @@ void RangeTest::constructDefault() { CORRADE_COMPARE(b2, Range2Di({0, 0}, {0, 0})); CORRADE_COMPARE(c1, Range3Di({0, 0, 0}, {0, 0, 0})); CORRADE_COMPARE(c2, Range3Di({0, 0, 0}, {0, 0, 0})); + + CORRADE_VERIFY(std::is_nothrow_default_constructible::value); + CORRADE_VERIFY(std::is_nothrow_default_constructible::value); + CORRADE_VERIFY(std::is_nothrow_default_constructible::value); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void RangeTest::constructNoInit() { @@ -208,6 +219,10 @@ void RangeTest::constructNoInit() { CORRADE_COMPARE(a, (Range1Di{3, 23})); CORRADE_COMPARE(b, (Range2Di{{3, 5}, {23, 78}})); CORRADE_COMPARE(c, (Range3Di{{3, 5, -7}, {23, 78, 2}})); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void RangeTest::constructFromSize() { @@ -235,6 +250,10 @@ void RangeTest::constructConversion() { CORRADE_VERIFY(!(std::is_convertible::value)); CORRADE_VERIFY(!(std::is_convertible::value)); CORRADE_VERIFY(!(std::is_convertible::value)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void RangeTest::constructCopy() { @@ -249,6 +268,13 @@ void RangeTest::constructCopy() { CORRADE_COMPARE(d, Range1Di(3, 23)); CORRADE_COMPARE(e, Range2Di({3, 5}, {23, 78})); CORRADE_COMPARE(f, Range3Di({3, 5, -7}, {23, 78, 2})); + + CORRADE_VERIFY(std::is_nothrow_copy_constructible::value); + CORRADE_VERIFY(std::is_nothrow_copy_constructible::value); + CORRADE_VERIFY(std::is_nothrow_copy_constructible::value); + CORRADE_VERIFY(std::is_nothrow_copy_assignable::value); + CORRADE_VERIFY(std::is_nothrow_copy_assignable::value); + CORRADE_VERIFY(std::is_nothrow_copy_assignable::value); } void RangeTest::convert() { diff --git a/src/Magnum/Math/Test/RectangularMatrixTest.cpp b/src/Magnum/Math/Test/RectangularMatrixTest.cpp index 964e8f961..7deb7e198 100644 --- a/src/Magnum/Math/Test/RectangularMatrixTest.cpp +++ b/src/Magnum/Math/Test/RectangularMatrixTest.cpp @@ -150,6 +150,8 @@ void RectangularMatrixTest::construct() { CORRADE_COMPARE(a, Matrix3x4(Vector4(1.0f, 2.0f, 3.0f, 4.0f), Vector4(5.0f, 6.0f, 7.0f, 8.0f), Vector4(9.0f, 10.0f, 11.0f, 12.0f))); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void RectangularMatrixTest::constructDefault() { @@ -163,6 +165,9 @@ void RectangularMatrixTest::constructDefault() { Vector3(0.0f, 0.0f, 0.0f), Vector3(0.0f, 0.0f, 0.0f), Vector3(0.0f, 0.0f, 0.0f))); + + CORRADE_VERIFY(std::is_nothrow_default_constructible::value); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void RectangularMatrixTest::constructNoInit() { @@ -173,6 +178,8 @@ void RectangularMatrixTest::constructNoInit() { CORRADE_COMPARE(a, Matrix3x4(Vector4(1.0f, 2.0f, 3.0f, 4.0f), Vector4(5.0f, 6.0f, 7.0f, 8.0f), Vector4(9.0f, 10.0f, 11.0f, 12.0f))); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void RectangularMatrixTest::constructConversion() { @@ -185,6 +192,8 @@ void RectangularMatrixTest::constructConversion() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void RectangularMatrixTest::constructFromData() { @@ -226,6 +235,9 @@ void RectangularMatrixTest::constructCopy() { CORRADE_COMPARE(b, Matrix3x4(Vector4(1.0f, 2.0f, 3.0f, 4.0f), Vector4(5.0f, 6.0f, 7.0f, 8.0f), Vector4(9.0f, 10.0f, 11.0f, 12.0f))); + + CORRADE_VERIFY(std::is_nothrow_copy_constructible::value); + CORRADE_VERIFY(std::is_nothrow_copy_assignable::value); } void RectangularMatrixTest::convert() { diff --git a/src/Magnum/Math/Test/UnitTest.cpp b/src/Magnum/Math/Test/UnitTest.cpp index 256497e90..8234958df 100644 --- a/src/Magnum/Math/Test/UnitTest.cpp +++ b/src/Magnum/Math/Test/UnitTest.cpp @@ -74,17 +74,23 @@ void UnitTest::construct() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); CORRADE_VERIFY(!(std::is_convertible::value)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void UnitTest::constructDefault() { constexpr Sec b; CORRADE_COMPARE(b, Sec(0.0f)); + + CORRADE_VERIFY(std::is_nothrow_default_constructible::value); } void UnitTest::constructNoInit() { Sec a{25.0f}; new(&a) Sec{NoInit}; CORRADE_COMPARE(a, Sec{25.0f}); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void UnitTest::constructConversion() { @@ -94,6 +100,8 @@ void UnitTest::constructConversion() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void UnitTest::compare() { diff --git a/src/Magnum/Math/Test/Vector2Test.cpp b/src/Magnum/Math/Test/Vector2Test.cpp index d066d8e21..55bee65e3 100644 --- a/src/Magnum/Math/Test/Vector2Test.cpp +++ b/src/Magnum/Math/Test/Vector2Test.cpp @@ -104,6 +104,8 @@ Vector2Test::Vector2Test() { void Vector2Test::construct() { constexpr Vector2 a = {1.5f, 2.5f}; CORRADE_COMPARE(a, (Vector<2, Float>(1.5f, 2.5f))); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void Vector2Test::constructDefault() { @@ -111,12 +113,17 @@ void Vector2Test::constructDefault() { constexpr Vector2 b{ZeroInit}; CORRADE_COMPARE(a, Vector2(0.0f, 0.0f)); CORRADE_COMPARE(b, Vector2(0.0f, 0.0f)); + + CORRADE_VERIFY(std::is_nothrow_default_constructible::value); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void Vector2Test::constructNoInit() { Vector2 a{1.5f, 2.5f}; new(&a) Vector2{NoInit}; CORRADE_COMPARE(a, (Vector2{1.5f, 2.5f})); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void Vector2Test::constructOneValue() { @@ -125,6 +132,8 @@ void Vector2Test::constructOneValue() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void Vector2Test::constructConversion() { @@ -134,6 +143,8 @@ void Vector2Test::constructConversion() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void Vector2Test::constructCopy() { @@ -143,6 +154,9 @@ void Vector2Test::constructCopy() { #endif Vector2 b(a); CORRADE_COMPARE(b, Vector2(1.5f, 2.5f)); + + CORRADE_VERIFY(std::is_nothrow_copy_constructible::value); + CORRADE_VERIFY(std::is_nothrow_copy_assignable::value); } void Vector2Test::convert() { diff --git a/src/Magnum/Math/Test/Vector3Test.cpp b/src/Magnum/Math/Test/Vector3Test.cpp index 8d53b8f79..72c5be4c1 100644 --- a/src/Magnum/Math/Test/Vector3Test.cpp +++ b/src/Magnum/Math/Test/Vector3Test.cpp @@ -102,6 +102,8 @@ Vector3Test::Vector3Test() { void Vector3Test::construct() { constexpr Vector3 a = {1.0f, 2.5f, -3.0f}; CORRADE_COMPARE(a, (Vector<3, Float>(1.0f, 2.5f, -3.0f))); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void Vector3Test::constructDefault() { @@ -109,12 +111,17 @@ void Vector3Test::constructDefault() { constexpr Vector3 b{ZeroInit}; CORRADE_COMPARE(a, Vector3(0.0f, 0.0f, 0.0f)); CORRADE_COMPARE(b, Vector3(0.0f, 0.0f, 0.0f)); + + CORRADE_VERIFY(std::is_nothrow_default_constructible::value); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void Vector3Test::constructNoInit() { Vector3 a{1.0f, 2.5f, -3.0f}; new(&a) Vector3{NoInit}; CORRADE_COMPARE(a, (Vector3{1.0f, 2.5f, -3.0f})); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void Vector3Test::constructOneValue() { @@ -123,12 +130,16 @@ void Vector3Test::constructOneValue() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void Vector3Test::constructParts() { constexpr Vector2 a(1.0f, 2.0f); constexpr Vector3 b = {a, 3.0f}; CORRADE_COMPARE(b, Vector3(1.0f, 2.0f, 3.0f)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void Vector3Test::constructConversion() { @@ -138,6 +149,8 @@ void Vector3Test::constructConversion() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void Vector3Test::constructCopy() { @@ -147,6 +160,9 @@ void Vector3Test::constructCopy() { #endif Vector3 b(a); CORRADE_COMPARE(b, Vector3(1.0f, 2.5f, -3.0f)); + + CORRADE_VERIFY(std::is_nothrow_copy_constructible::value); + CORRADE_VERIFY(std::is_nothrow_copy_assignable::value); } void Vector3Test::convert() { diff --git a/src/Magnum/Math/Test/Vector4Test.cpp b/src/Magnum/Math/Test/Vector4Test.cpp index 5eff2562a..2dcce57b8 100644 --- a/src/Magnum/Math/Test/Vector4Test.cpp +++ b/src/Magnum/Math/Test/Vector4Test.cpp @@ -101,6 +101,8 @@ Vector4Test::Vector4Test() { void Vector4Test::construct() { constexpr Vector4 a = {1.0f, -2.5f, 3.0f, 4.1f}; CORRADE_COMPARE(a, (Vector<4, Float>(1.0f, -2.5f, 3.0f, 4.1f))); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void Vector4Test::constructPad() { @@ -124,12 +126,17 @@ void Vector4Test::constructDefault() { constexpr Vector4 b{ZeroInit}; CORRADE_COMPARE(a, Vector4(0.0f, 0.0f, 0.0f, 0.0f)); CORRADE_COMPARE(b, Vector4(0.0f, 0.0f, 0.0f, 0.0f)); + + CORRADE_VERIFY(std::is_nothrow_default_constructible::value); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void Vector4Test::constructNoInit() { Vector4 a{1.0f, -2.5f, 3.0f, 4.1f}; new(&a) Vector4{NoInit}; CORRADE_COMPARE(a, (Vector4{1.0f, -2.5f, 3.0f, 4.1f})); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void Vector4Test::constructOneValue() { @@ -138,12 +145,16 @@ void Vector4Test::constructOneValue() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void Vector4Test::constructParts() { constexpr Vector3 a(1.0f, 2.0f, 3.0f); constexpr Vector4 b = {a, 4.0f}; CORRADE_COMPARE(b, Vector4(1.0f, 2.0f, 3.0f, 4.0f)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void Vector4Test::constructConversion() { @@ -153,6 +164,8 @@ void Vector4Test::constructConversion() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void Vector4Test::constructCopy() { @@ -162,6 +175,9 @@ void Vector4Test::constructCopy() { #endif Vector4 b(a); CORRADE_COMPARE(b, Vector4(1.0f, -2.5f, 3.0f, 4.1f)); + + CORRADE_VERIFY(std::is_nothrow_copy_constructible::value); + CORRADE_VERIFY(std::is_nothrow_copy_assignable::value); } void Vector4Test::convert() { diff --git a/src/Magnum/Math/Test/VectorTest.cpp b/src/Magnum/Math/Test/VectorTest.cpp index c525242b9..5c754a3b6 100644 --- a/src/Magnum/Math/Test/VectorTest.cpp +++ b/src/Magnum/Math/Test/VectorTest.cpp @@ -174,6 +174,8 @@ VectorTest::VectorTest() { void VectorTest::construct() { constexpr Vector4 a = {1.0f, 2.0f, -3.0f, 4.5f}; CORRADE_COMPARE(a, Vector4(1.0f, 2.0f, -3.0f, 4.5f)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void VectorTest::constructFromData() { @@ -198,12 +200,17 @@ void VectorTest::constructDefault() { constexpr Vector4 b{ZeroInit}; CORRADE_COMPARE(a, Vector4(0.0f, 0.0f, 0.0f, 0.0f)); CORRADE_COMPARE(b, Vector4(0.0f, 0.0f, 0.0f, 0.0f)); + + CORRADE_VERIFY(std::is_nothrow_default_constructible::value); + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void VectorTest::constructNoInit() { Vector4 a{1.0f, 2.0f, -3.0f, 4.5f}; new(&a) Vector4{NoInit}; CORRADE_COMPARE(a, (Vector4{1.0f, 2.0f, -3.0f, 4.5f})); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void VectorTest::constructOneValue() { @@ -213,6 +220,8 @@ void VectorTest::constructOneValue() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void VectorTest::constructOneComponent() { @@ -221,6 +230,8 @@ void VectorTest::constructOneComponent() { /* Implicit constructor must work */ constexpr Vector1 vec = 1.0f; CORRADE_COMPARE(vec, Vector1(1)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void VectorTest::constructConversion() { @@ -231,12 +242,17 @@ void VectorTest::constructConversion() { /* Implicit conversion is not allowed */ CORRADE_VERIFY(!(std::is_convertible::value)); + + CORRADE_VERIFY((std::is_nothrow_constructible::value)); } void VectorTest::constructCopy() { constexpr Vector4 a(1.0f, 3.5f, 4.0f, -2.7f); constexpr Vector4 b(a); CORRADE_COMPARE(b, Vector4(1.0f, 3.5f, 4.0f, -2.7f)); + + CORRADE_VERIFY(std::is_nothrow_copy_constructible::value); + CORRADE_VERIFY(std::is_nothrow_copy_assignable::value); } void VectorTest::convert() { diff --git a/src/Magnum/Math/Unit.h b/src/Magnum/Math/Unit.h index 840df7f47..571b98e22 100644 --- a/src/Magnum/Math/Unit.h +++ b/src/Magnum/Math/Unit.h @@ -47,16 +47,19 @@ template class Derived, class T> class Unit { typedef T Type; /**< @brief Underlying data type */ /** @brief Construct zero value */ - constexpr /*implicit*/ Unit(ZeroInitT = ZeroInit): _value(T(0)) {} + constexpr /*implicit*/ Unit(ZeroInitT = ZeroInit) noexcept: _value(T(0)) {} /** @brief Construct without initializing the contents */ - explicit Unit(NoInitT) {} + explicit Unit(NoInitT) noexcept {} /** @brief Explicit conversion from unitless type */ - constexpr explicit Unit(T value): _value(value) {} + constexpr explicit Unit(T value) noexcept: _value(value) {} /** @brief Construct from another underlying type */ - template constexpr explicit Unit(Unit value): _value(T(value._value)) {} + template constexpr explicit Unit(Unit value) noexcept: _value(T(value._value)) {} + + /** @brief Copy constructor */ + constexpr /*implicit*/ Unit(const Unit& other) noexcept = default; /** @brief Explicit conversion to underlying type */ constexpr explicit operator T() const { return _value; } diff --git a/src/Magnum/Math/Vector.h b/src/Magnum/Math/Vector.h index 3755feba7..7f40e1d65 100644 --- a/src/Magnum/Math/Vector.h +++ b/src/Magnum/Math/Vector.h @@ -173,10 +173,10 @@ template class Vector { * \boldsymbol v = \boldsymbol 0 * @f] */ - constexpr /*implicit*/ Vector(ZeroInitT = ZeroInit): _data{} {} + constexpr /*implicit*/ Vector(ZeroInitT = ZeroInit) noexcept: _data{} {} /** @brief Construct vector without initializing the contents */ - explicit Vector(NoInitT) {} + explicit Vector(NoInitT) noexcept {} /** @todo Creating Vector from combination of vector and scalar types */ @@ -186,16 +186,16 @@ template class Vector { * @param next Next values */ #ifdef DOXYGEN_GENERATING_OUTPUT - template constexpr /*implicit*/ Vector(T first, U... next); + template constexpr /*implicit*/ Vector(T first, U... next) noexcept; #else - template::type> constexpr /*implicit*/ Vector(T first, U... next): _data{first, next...} {} + template::type> constexpr /*implicit*/ Vector(T first, U... next) noexcept: _data{first, next...} {} #endif /** @brief Construct vector with one value for all fields */ #ifdef DOXYGEN_GENERATING_OUTPUT - constexpr explicit Vector(T value); + constexpr explicit Vector(T value) noexcept; #else - template::value && size != 1, T>::type> constexpr explicit Vector(U value): Vector(typename Implementation::GenerateSequence::Type(), value) {} + template::value && size != 1, T>::type> constexpr explicit Vector(U value) noexcept: Vector(typename Implementation::GenerateSequence::Type(), value) {} #endif /** @@ -209,13 +209,13 @@ template class Vector { * // integral == {1, 2, -15, 7} * @endcode */ - template constexpr explicit Vector(const Vector& other): Vector(typename Implementation::GenerateSequence::Type(), other) {} + template constexpr explicit Vector(const Vector& other) noexcept: Vector(typename Implementation::GenerateSequence::Type(), other) {} /** @brief Construct vector from external representation */ - template::from(std::declval()))> constexpr explicit Vector(const U& other): Vector(Implementation::VectorConverter::from(other)) {} + template::from(std::declval()))> constexpr explicit Vector(const U& other) noexcept: Vector(Implementation::VectorConverter::from(other)) {} /** @brief Copy constructor */ - constexpr Vector(const Vector&) = default; + constexpr /*implicit*/ Vector(const Vector&) noexcept = default; /** @brief Convert vector to external representation */ template::to(std::declval>()))> constexpr explicit operator U() const { @@ -574,10 +574,10 @@ template class Vector { private: /* Implementation for Vector::Vector(const Vector&) */ - template constexpr explicit Vector(Implementation::Sequence, const Vector& vector): _data{T(vector._data[sequence])...} {} + template constexpr explicit Vector(Implementation::Sequence, const Vector& vector) noexcept: _data{T(vector._data[sequence])...} {} /* Implementation for Vector::Vector(U) */ - template constexpr explicit Vector(Implementation::Sequence, T value): _data{Implementation::repeat(value, sequence)...} {} + template constexpr explicit Vector(Implementation::Sequence, T value) noexcept: _data{Implementation::repeat(value, sequence)...} {} template constexpr static Vector padInternal(Implementation::Sequence, const Vector& a, T value) { return {sequence < otherSize ? a[sequence] : value...}; diff --git a/src/Magnum/Math/Vector2.h b/src/Magnum/Math/Vector2.h index 9bd0809ff..1c6d68e2d 100644 --- a/src/Magnum/Math/Vector2.h +++ b/src/Magnum/Math/Vector2.h @@ -112,7 +112,7 @@ template class Vector2: public Vector<2, T> { #endif /** @copydoc Vector::Vector(ZeroInitT) */ - constexpr /*implicit*/ Vector2(ZeroInitT = ZeroInit) + constexpr /*implicit*/ Vector2(ZeroInitT = ZeroInit) noexcept /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ @@ -121,7 +121,7 @@ template class Vector2: public Vector<2, T> { {} /** @copydoc Vector::Vector(NoInitT) */ - explicit Vector2(NoInitT) + explicit Vector2(NoInitT) noexcept /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ @@ -130,7 +130,7 @@ template class Vector2: public Vector<2, T> { {} /** @copydoc Vector::Vector(T) */ - constexpr explicit Vector2(T value): Vector<2, T>(value) {} + constexpr explicit Vector2(T value) noexcept: Vector<2, T>(value) {} /** * @brief Constructor @@ -139,10 +139,10 @@ template class Vector2: public Vector<2, T> { * \boldsymbol v = \begin{pmatrix} x \\ y \end{pmatrix} * @f] */ - constexpr /*implicit*/ Vector2(T x, T y): Vector<2, T>(x, y) {} + constexpr /*implicit*/ Vector2(T x, T y) noexcept: Vector<2, T>(x, y) {} /** @copydoc Vector::Vector(const Vector&) */ - template constexpr explicit Vector2(const Vector<2, U>& other): Vector<2, T>(other) {} + template constexpr explicit Vector2(const Vector<2, U>& other) noexcept: Vector<2, T>(other) {} /** @brief Construct vector from external representation */ template class Vector2: public Vector<2, T> { constexpr explicit Vector2(const U& other): Vector<2, T>(Implementation::VectorConverter<2, T, U>::from(other)) {} /** @brief Copy constructor */ - constexpr Vector2(const Vector<2, T>& other): Vector<2, T>(other) {} + constexpr /*implicit*/ Vector2(const Vector<2, T>& other) noexcept: Vector<2, T>(other) {} T& x() { return (*this)[0]; } /**< @brief X component */ constexpr T x() const { return (*this)[0]; } /**< @overload */ diff --git a/src/Magnum/Math/Vector3.h b/src/Magnum/Math/Vector3.h index 4302c5322..0b14ea04e 100644 --- a/src/Magnum/Math/Vector3.h +++ b/src/Magnum/Math/Vector3.h @@ -134,7 +134,7 @@ template class Vector3: public Vector<3, T> { #endif /** @copydoc Vector::Vector(ZeroInitT) */ - constexpr /*implicit*/ Vector3(ZeroInitT = ZeroInit) + constexpr /*implicit*/ Vector3(ZeroInitT = ZeroInit) noexcept /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ @@ -143,7 +143,7 @@ template class Vector3: public Vector<3, T> { {} /** @copydoc Vector::Vector(NoInitT) */ - explicit Vector3(NoInitT) + explicit Vector3(NoInitT) noexcept /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ @@ -152,7 +152,7 @@ template class Vector3: public Vector<3, T> { {} /** @copydoc Vector::Vector(T) */ - constexpr explicit Vector3(T value): Vector<3, T>(value) {} + constexpr explicit Vector3(T value) noexcept: Vector<3, T>(value) {} /** * @brief Constructor @@ -161,7 +161,7 @@ template class Vector3: public Vector<3, T> { * \boldsymbol v = \begin{pmatrix} x \\ y \\ z \end{pmatrix} * @f] */ - constexpr /*implicit*/ Vector3(T x, T y, T z): Vector<3, T>(x, y, z) {} + constexpr /*implicit*/ Vector3(T x, T y, T z) noexcept: Vector<3, T>(x, y, z) {} /** * @brief Constructor @@ -170,10 +170,10 @@ template class Vector3: public Vector<3, T> { * \boldsymbol v = \begin{pmatrix} v_x \\ v_y \\ z \end{pmatrix} * @f] */ - constexpr /*implicit*/ Vector3(const Vector2& xy, T z): Vector<3, T>(xy[0], xy[1], z) {} + constexpr /*implicit*/ Vector3(const Vector2& xy, T z) noexcept: Vector<3, T>(xy[0], xy[1], z) {} /** @copydoc Vector::Vector(const Vector&) */ - template constexpr explicit Vector3(const Vector<3, U>& other): Vector<3, T>(other) {} + template constexpr explicit Vector3(const Vector<3, U>& other) noexcept: Vector<3, T>(other) {} /** @brief Construct vector from external representation */ template class Vector3: public Vector<3, T> { constexpr explicit Vector3(const U& other): Vector<3, T>(Implementation::VectorConverter<3, T, U>::from(other)) {} /** @brief Copy constructor */ - constexpr Vector3(const Vector<3, T>& other): Vector<3, T>(other) {} + constexpr /*implicit*/ Vector3(const Vector<3, T>& other) noexcept: Vector<3, T>(other) {} /** * @brief X component diff --git a/src/Magnum/Math/Vector4.h b/src/Magnum/Math/Vector4.h index baf4c7ee0..1323b3ee4 100644 --- a/src/Magnum/Math/Vector4.h +++ b/src/Magnum/Math/Vector4.h @@ -60,7 +60,7 @@ template class Vector4: public Vector<4, T> { } /** @copydoc Vector::Vector(ZeroInitT) */ - constexpr /*implicit*/ Vector4(ZeroInitT = ZeroInit) + constexpr /*implicit*/ Vector4(ZeroInitT = ZeroInit) noexcept /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ @@ -69,7 +69,7 @@ template class Vector4: public Vector<4, T> { {} /** @copydoc Vector::Vector(NoInitT) */ - explicit Vector4(NoInitT) + explicit Vector4(NoInitT) noexcept /** @todoc remove workaround when doxygen is sane */ #ifndef DOXYGEN_GENERATING_OUTPUT /* MSVC 2015 can't handle {} here */ @@ -78,7 +78,7 @@ template class Vector4: public Vector<4, T> { {} /** @copydoc Vector::Vector(T) */ - constexpr explicit Vector4(T value): Vector<4, T>(value) {} + constexpr explicit Vector4(T value) noexcept: Vector<4, T>(value) {} /** * @brief Constructor @@ -87,7 +87,7 @@ template class Vector4: public Vector<4, T> { * \boldsymbol v = \begin{pmatrix} x \\ y \\ z \\ w \end{pmatrix} * @f] */ - constexpr /*implicit*/ Vector4(T x, T y, T z, T w): Vector<4, T>(x, y, z, w) {} + constexpr /*implicit*/ Vector4(T x, T y, T z, T w) noexcept: Vector<4, T>(x, y, z, w) {} /** * @brief Constructor @@ -96,16 +96,16 @@ template class Vector4: public Vector<4, T> { * \boldsymbol v = \begin{pmatrix} v_x \\ v_y \\ v_z \\ w \end{pmatrix} * @f] */ - constexpr /*implicit*/ Vector4(const Vector3& xyz, T w): Vector<4, T>(xyz[0], xyz[1], xyz[2], w) {} + constexpr /*implicit*/ Vector4(const Vector3& xyz, T w) noexcept: Vector<4, T>(xyz[0], xyz[1], xyz[2], w) {} /** @copydoc Vector::Vector(const Vector&) */ - template constexpr explicit Vector4(const Vector<4, U>& other): Vector<4, T>(other) {} + template constexpr explicit Vector4(const Vector<4, U>& other) noexcept: Vector<4, T>(other) {} /** @brief Construct vector from external representation */ template::from(std::declval()))> constexpr explicit Vector4(const U& other): Vector<4, T>(Implementation::VectorConverter<4, T, U>::from(other)) {} /** @brief Copy constructor */ - constexpr Vector4(const Vector<4, T>& other): Vector<4, T>(other) {} + constexpr /*implicit*/ Vector4(const Vector<4, T>& other) noexcept: Vector<4, T>(other) {} /** * @brief X component