From 57e2c47caba2e8f431fab5e70b71e97d5b1358d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 21 Jan 2014 02:23:54 +0100 Subject: [PATCH] MSVC 2013 compatibility: more workarounds for array initialization bug. Followup to e2180ee85bf9f4d938f413a625fbdd4cd950d953. --- src/Magnum/Math/RectangularMatrix.h | 7 ++++++- src/Magnum/Math/Vector.h | 18 ++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/Magnum/Math/RectangularMatrix.h b/src/Magnum/Math/RectangularMatrix.h index c6c11dd61..e2e9bb875 100644 --- a/src/Magnum/Math/RectangularMatrix.h +++ b/src/Magnum/Math/RectangularMatrix.h @@ -673,7 +673,12 @@ namespace Implementation { } #ifndef CORRADE_GCC45_COMPATIBILITY -template template inline constexpr RectangularMatrix::RectangularMatrix(Implementation::Sequence, const Vector& diagonal): _data{Implementation::diagonalMatrixColumn(sequence < DiagonalSize ? diagonal[sequence] : T{})...} {} +template template inline constexpr RectangularMatrix::RectangularMatrix(Implementation::Sequence, const Vector& diagonal): + #ifndef CORRADE_MSVC2013_COMPATIBILITY + _data{Implementation::diagonalMatrixColumn(sequence < DiagonalSize ? diagonal[sequence] : T{})...} {} + #else + _data({Implementation::diagonalMatrixColumn(sequence < DiagonalSize ? diagonal[sequence] : T{})...}) {} + #endif #else template template inline RectangularMatrix::RectangularMatrix(Implementation::Sequence, const Vector& diagonal) { constructInternal({Implementation::diagonalMatrixColumn(sequence < DiagonalSize ? diagonal[sequence] : T{})...}); diff --git a/src/Magnum/Math/Vector.h b/src/Magnum/Math/Vector.h index 00a46d588..7adda1d58 100644 --- a/src/Magnum/Math/Vector.h +++ b/src/Magnum/Math/Vector.h @@ -204,8 +204,22 @@ template class Vector { * * @see operator[]() */ - T* data() { return _data; } - constexpr const T* data() const { return _data; } /**< @overload */ + T* data() { + #ifndef CORRADE_MSVC2013_COMPATIBILITY + return _data; + #else + return &_data[0]; + #endif + } + + /** @overload */ + constexpr const T* data() const { + #ifndef CORRADE_MSVC2013_COMPATIBILITY + return _data; + #else + return &_data[0]; + #endif + } /** * @brief Value at given position