Browse Source

Math: these aren't constexpr by a long shot.

pull/51/head
Vladimír Vondruš 13 years ago
parent
commit
4846b4b2ed
  1. 8
      src/Math/RectangularMatrix.h
  2. 8
      src/Math/Vector.h

8
src/Math/RectangularMatrix.h

@ -76,11 +76,11 @@ template<std::size_t cols, std::size_t rows, class T> class RectangularMatrix {
* @attention Use with caution, the function doesn't check whether the
* array is long enough.
*/
constexpr static RectangularMatrix<cols, rows, T>& from(T* data) {
static RectangularMatrix<cols, rows, T>& from(T* data) {
return *reinterpret_cast<RectangularMatrix<cols, rows, T>*>(data);
}
/** @overload */
constexpr static const RectangularMatrix<cols, rows, T>& from(const T* data) {
static const RectangularMatrix<cols, rows, T>& from(const T* data) {
return *reinterpret_cast<const RectangularMatrix<cols, rows, T>*>(data);
}
@ -531,10 +531,10 @@ extern template Corrade::Utility::Debug MAGNUM_EXPORT operator<<(Corrade::Utilit
#endif
#define MAGNUM_RECTANGULARMATRIX_SUBCLASS_IMPLEMENTATION(cols, rows, ...) \
constexpr static __VA_ARGS__& from(T* data) { \
static __VA_ARGS__& from(T* data) { \
return *reinterpret_cast<__VA_ARGS__*>(data); \
} \
constexpr static const __VA_ARGS__& from(const T* data) { \
static const __VA_ARGS__& from(const T* data) { \
return *reinterpret_cast<const __VA_ARGS__*>(data); \
} \
\

8
src/Math/Vector.h

@ -71,11 +71,11 @@ template<std::size_t size, class T> class Vector {
* @attention Use with caution, the function doesn't check whether the
* array is long enough.
*/
constexpr static Vector<size, T>& from(T* data) {
static Vector<size, T>& from(T* data) {
return *reinterpret_cast<Vector<size, T>*>(data);
}
/** @overload */
constexpr static const Vector<size, T>& from(const T* data) {
static const Vector<size, T>& from(const T* data) {
return *reinterpret_cast<const Vector<size, T>*>(data);
}
@ -1042,10 +1042,10 @@ extern template Corrade::Utility::Debug MAGNUM_EXPORT operator<<(Corrade::Utilit
#ifndef DOXYGEN_GENERATING_OUTPUT
#define MAGNUM_VECTOR_SUBCLASS_IMPLEMENTATION(size, Type) \
constexpr static Type<T>& from(T* data) { \
static Type<T>& from(T* data) { \
return *reinterpret_cast<Type<T>*>(data); \
} \
constexpr static const Type<T>& from(const T* data) { \
static const Type<T>& from(const T* data) { \
return *reinterpret_cast<const Type<T>*>(data); \
} \
\

Loading…
Cancel
Save