Browse Source

Math: make Matrix::Matrix(T) constexpr also under CC 4.6.

pull/51/head
Vladimír Vondruš 13 years ago
parent
commit
340d020507
  1. 9
      src/Math/Matrix.h
  2. 5
      src/Math/Vector.h

9
src/Math/Matrix.h

@ -70,7 +70,14 @@ template<std::size_t size, class T> class Matrix: public RectangularMatrix<size,
* `Matrix m(Matrix::Identity);`. Optional parameter @p value allows
* you to specify value on diagonal.
*/
constexpr /*implicit*/ Matrix(IdentityType = Identity, T value = T(1)): RectangularMatrix<size, size, T>(typename Implementation::GenerateSequence<size>::Type(), Vector<size, T>(value)) {}
constexpr /*implicit*/ Matrix(IdentityType = Identity, T value = T(1)): RectangularMatrix<size, size, T>(typename Implementation::GenerateSequence<size>::Type(),
/* The original one is not constexpr under GCC 4.6 */
#ifndef CORRADE_GCC46_COMPATIBILITY
Vector<size, T>(value)
#else
Vector<size, T>(typename Implementation::GenerateSequence<size>::Type(), value)
#endif
) {}
/**
* @brief %Matrix from column vectors

5
src/Math/Vector.h

@ -59,6 +59,11 @@ template<std::size_t size, class T> class Vector {
template<std::size_t, class> friend class Vector;
#ifdef CORRADE_GCC46_COMPATIBILITY
/* So it can call internal constexpr constructor from one value */
template<std::size_t, class> friend class Matrix;
#endif
public:
typedef T Type; /**< @brief Underlying data type */
const static std::size_t Size = size; /**< @brief %Vector size */

Loading…
Cancel
Save