Browse Source

Math: get rid of needless GenerateReverseSequence utility.

pull/218/head
Criss 9 years ago committed by Vladimír Vondruš
parent
commit
98f920527e
  1. 7
      src/Magnum/Math/BoolVector.h
  2. 4
      src/Magnum/Math/RectangularMatrix.h
  3. 4
      src/Magnum/Math/Vector.h

7
src/Magnum/Math/BoolVector.h

@ -49,13 +49,6 @@ namespace Implementation {
template<std::size_t ...sequence> struct GenerateSequence<0, sequence...> { template<std::size_t ...sequence> struct GenerateSequence<0, sequence...> {
typedef Sequence<sequence...> Type; typedef Sequence<sequence...> Type;
}; };
template<std::size_t N, std::size_t ...sequence> struct GenerateReverseSequence:
GenerateReverseSequence<N-1, sequence..., N-1> {};
template<std::size_t ...sequence> struct GenerateReverseSequence<0, sequence...> {
typedef Sequence<sequence...> Type;
};
#endif #endif
template<class T> constexpr T repeat(T value, std::size_t) { return value; } template<class T> constexpr T repeat(T value, std::size_t) { return value; }

4
src/Magnum/Math/RectangularMatrix.h

@ -400,7 +400,7 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
* @see @ref transposed(), @ref flippedRows(), @ref Vector::flipped() * @see @ref transposed(), @ref flippedRows(), @ref Vector::flipped()
*/ */
constexpr RectangularMatrix<cols, rows, T> flippedCols() const { constexpr RectangularMatrix<cols, rows, T> flippedCols() const {
return flippedColsInternal(typename Implementation::GenerateReverseSequence<cols>::Type{}); return flippedColsInternal(typename Implementation::GenerateSequence<cols>::Type{});
} }
/** /**
@ -454,7 +454,7 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
template<class U, std::size_t ...sequence> constexpr explicit RectangularMatrix(Implementation::Sequence<sequence...>, U) noexcept: _data{Vector<rows, T>((static_cast<void>(sequence), U{typename U::Init{}}))...} {} template<class U, std::size_t ...sequence> constexpr explicit RectangularMatrix(Implementation::Sequence<sequence...>, U) noexcept: _data{Vector<rows, T>((static_cast<void>(sequence), U{typename U::Init{}}))...} {}
template<std::size_t ...sequence> constexpr RectangularMatrix<cols, rows, T> flippedColsInternal(Implementation::Sequence<sequence...>) const { template<std::size_t ...sequence> constexpr RectangularMatrix<cols, rows, T> flippedColsInternal(Implementation::Sequence<sequence...>) const {
return {(*this)[sequence]...}; return {(*this)[cols - 1 - sequence]...};
} }
template<std::size_t ...sequence> constexpr RectangularMatrix<cols, rows, T> flippedRowsInternal(Implementation::Sequence<sequence...>) const { template<std::size_t ...sequence> constexpr RectangularMatrix<cols, rows, T> flippedRowsInternal(Implementation::Sequence<sequence...>) const {

4
src/Magnum/Math/Vector.h

@ -537,7 +537,7 @@ template<std::size_t size, class T> class Vector {
* @ref RectangularMatrix::flippedRows() * @ref RectangularMatrix::flippedRows()
*/ */
constexpr Vector<size, T> flipped() const { constexpr Vector<size, T> flipped() const {
return flippedInternal(typename Implementation::GenerateReverseSequence<size>::Type{}); return flippedInternal(typename Implementation::GenerateSequence<size>::Type{});
} }
/** /**
@ -587,7 +587,7 @@ template<std::size_t size, class T> class Vector {
} }
template<std::size_t ...sequence> constexpr Vector<size, T> flippedInternal(Implementation::Sequence<sequence...>) const { template<std::size_t ...sequence> constexpr Vector<size, T> flippedInternal(Implementation::Sequence<sequence...>) const {
return {(*this)[sequence]...}; return {(*this)[size - 1 - sequence]...};
} }
T _data[size]; T _data[size];

Loading…
Cancel
Save