diff --git a/src/Array.h b/src/Array.h index 622c48709..75a185a52 100644 --- a/src/Array.h +++ b/src/Array.h @@ -33,6 +33,10 @@ #include "Math/BoolVector.h" /* for Math::Implementation::Sequence */ #include "Magnum.h" +#ifdef CORRADE_MSVC2013_COMPATIBILITY +#include +#endif + namespace Magnum { /** @@ -107,9 +111,18 @@ template class Array { private: /* Implementation for Array::Array(U) */ - template constexpr explicit Array(Math::Implementation::Sequence, T value): _data{Math::Implementation::repeat(value, sequence)...} {} - + template constexpr explicit Array(Math::Implementation::Sequence, T value): + #ifndef CORRADE_MSVC2013_COMPATIBILITY + _data{Math::Implementation::repeat(value, sequence)...} {} + #else + _data({Math::Implementation::repeat(value, sequence)...}) {} + #endif + + #ifndef CORRADE_MSVC2013_COMPATIBILITY T _data[dimensions]; + #else + std::array _data; + #endif }; /** diff --git a/src/Color.h b/src/Color.h index 342dcee05..8e9b6e571 100644 --- a/src/Color.h +++ b/src/Color.h @@ -441,7 +441,12 @@ class BasicColor4: public Math::Vector4 { * @param alpha Alpha value, defaults to 1.0 for floating-point types * and maximum positive value for integral types. */ + #ifndef CORRADE_MSVC2013_COMPATIBILITY constexpr explicit BasicColor4(T rgb, T alpha = Implementation::fullChannel()): Math::Vector4(rgb, rgb, rgb, alpha) {} + #else + template::value, T>::type> constexpr explicit BasicColor4(T rgb, T alpha = T(1)): Math::Vector4(rgb, rgb, rgb, alpha) {} + template::value, T>::type> constexpr explicit BasicColor4(T rgb, T alpha = std::numeric_limits::max()): Math::Vector4(rgb, rgb, rgb, alpha) {} + #endif /** * @brief Constructor @@ -451,7 +456,12 @@ class BasicColor4: public Math::Vector4 { * @param a A value, defaults to 1.0 for floating-point types and * maximum positive value for integral types. */ + #ifndef CORRADE_MSVC2013_COMPATIBILITY constexpr /*implicit*/ BasicColor4(T r, T g, T b, T a = Implementation::fullChannel()): Math::Vector4(r, g, b, a) {} + #else + template::value, T>::type> constexpr /*implicit*/ BasicColor4(T r, T g, T b, T a = T(1)): Math::Vector4(r, g, b, a) {} + template::value, T>::type> constexpr /*implicit*/ BasicColor4(T r, T g, T b, T a = std::numeric_limits::max()): Math::Vector4(r, g, b, a) {} + #endif /** * @brief Constructor @@ -460,7 +470,12 @@ class BasicColor4: public Math::Vector4 { */ /* Not marked as explicit, because conversion from BasicColor3 to BasicColor4 is fairly common, nearly always with A set to 1 */ + #ifndef CORRADE_MSVC2013_COMPATIBILITY constexpr /*implicit*/ BasicColor4(const Math::Vector3& rgb, T a = Implementation::fullChannel()): Math::Vector4(rgb[0], rgb[1], rgb[2], a) {} + #else + template::value, T>::type> constexpr /*implicit*/ BasicColor4(const Math::Vector3& rgb, T a = T(1)): Math::Vector4(rgb[0], rgb[1], rgb[2], a) {} + template::value, T>::type> constexpr /*implicit*/ BasicColor4(const Math::Vector3& rgb, T a = std::numeric_limits::max()): Math::Vector4(rgb[0], rgb[1], rgb[2], a) {} + #endif /** * @copydoc Math::Vector::Vector(const Vector&) diff --git a/src/Math/RectangularMatrix.h b/src/Math/RectangularMatrix.h index 19a09c8a3..74f65894d 100644 --- a/src/Math/RectangularMatrix.h +++ b/src/Math/RectangularMatrix.h @@ -114,7 +114,13 @@ template class RectangularMatrix { * @todo Creating matrix from arbitrary combination of matrices with n rows */ #ifndef CORRADE_GCC45_COMPATIBILITY - template constexpr /*implicit*/ RectangularMatrix(const Vector& first, const U&... next): _data{first, next...} { + template constexpr /*implicit*/ RectangularMatrix(const Vector& first, const U&... next): + #ifndef CORRADE_MSVC2013_COMPATIBILITY + _data{first, next...} + #else + _data({first, next...}) + #endif + { #else template /*implicit*/ RectangularMatrix(const Vector& first, const U&... next): _data() { constructInternal({first, next...}); @@ -389,7 +395,12 @@ template class RectangularMatrix { private: /* Implementation for RectangularMatrix::RectangularMatrix(const RectangularMatrix&) */ #ifndef CORRADE_GCC45_COMPATIBILITY - template constexpr explicit RectangularMatrix(Implementation::Sequence, const RectangularMatrix& matrix): _data{Vector(matrix[sequence])...} {} + template constexpr explicit RectangularMatrix(Implementation::Sequence, const RectangularMatrix& matrix): + #ifndef CORRADE_MSVC2013_COMPATIBILITY + _data{Vector(matrix[sequence])...} {} + #else + _data({Vector(matrix[sequence])...}) {} + #endif #else template explicit RectangularMatrix(Implementation::Sequence, const RectangularMatrix& matrix): _data() { constructInternal({Vector(matrix[sequence])...}); @@ -404,7 +415,11 @@ template class RectangularMatrix { } #endif + #ifndef CORRADE_MSVC2013_COMPATIBILITY Vector _data[cols]; + #else + std::array, cols> _data; + #endif }; #ifndef CORRADE_GCC46_COMPATIBILITY diff --git a/src/Math/Vector.h b/src/Math/Vector.h index edd6f49f2..9b66f4e35 100644 --- a/src/Math/Vector.h +++ b/src/Math/Vector.h @@ -40,6 +40,10 @@ #include "magnumVisibility.h" +#ifdef CORRADE_MSVC2013_COMPATIBILITY +#include +#endif + namespace Magnum { namespace Math { namespace Implementation { @@ -122,7 +126,12 @@ template class Vector { #ifdef DOXYGEN_GENERATING_OUTPUT template constexpr /*implicit*/ Vector(T first, U... next); #else - template::type> constexpr /*implicit*/ Vector(T first, U... next): _data{first, next...} {} + template::type> constexpr /*implicit*/ Vector(T first, U... next): + #ifndef CORRADE_MSVC2013_COMPATIBILITY + _data{first, next...} {} + #else + _data({first, next...}) {} + #endif #endif /** @brief Construct vector with one value for all fields */ @@ -198,7 +207,11 @@ template class Vector { #if !defined(CORRADE_GCC47_COMPATIBILITY) && !defined(CORRADE_MSVC2013_COMPATIBILITY) & #endif + #ifndef CORRADE_MSVC2013_COMPATIBILITY { return _data; } + #else + { return _data.data(); } + #endif /** @overload */ constexpr const T* data() @@ -207,7 +220,11 @@ template class Vector { #else const #endif + #ifndef CORRADE_MSVC2013_COMPATIBILITY { return _data; } + #else + { return _data.data(); } + #endif /** * @brief Value at given position @@ -537,12 +554,26 @@ 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): + #ifndef CORRADE_MSVC2013_COMPATIBILITY + _data{T(vector._data[sequence])...} {} + #else + _data({T(vector._data[sequence])...}) {} + #endif /* 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): + #ifndef CORRADE_MSVC2013_COMPATIBILITY + _data{Implementation::repeat(value, sequence)...} {} + #else + _data({Implementation::repeat(value, sequence)...}) {} + #endif + + #ifndef CORRADE_MSVC2013_COMPATIBILITY T _data[size]; + #else + std::array _data; + #endif }; /** @relates Vector