Browse Source

Math: got rid of MathTypeTraits::NumericType.

Was workaround for printing chars with Corrade::Utility::Debug as
integers, not needed anymore.
pull/7/head
Vladimír Vondruš 14 years ago
parent
commit
03789a5b4b
  1. 18
      src/Math/MathTypeTraits.h
  2. 2
      src/Math/RectangularMatrix.h
  3. 2
      src/Math/Vector.h

18
src/Math/MathTypeTraits.h

@ -56,14 +56,6 @@ template<class T> struct MathTypeTraits {
*/
#ifdef DOXYGEN_GENERATING_OUTPUT
/**
* @brief Corresponding numeric type large at least as 32bit integer
*
* Usable e.g. to prevent conversion of `char` to characters when printing
* numeric types to output.
*/
typedef U NumericType;
/**
* @brief Corresponding floating-point type for normalization
*
@ -123,49 +115,39 @@ template<class T> struct MathTypeTraitsFloatingPoint {
}
template<> struct MathTypeTraits<std::uint8_t>: Implementation::MathTypeTraitsIntegral<std::uint8_t> {
typedef std::uint32_t NumericType;
typedef float FloatingPointType;
};
template<> struct MathTypeTraits<std::int8_t>: Implementation::MathTypeTraitsIntegral<std::int8_t> {
typedef std::int32_t NumericType;
typedef float FloatingPointType;
};
template<> struct MathTypeTraits<std::uint16_t>: Implementation::MathTypeTraitsIntegral<std::uint16_t> {
typedef std::uint32_t NumericType;
typedef float FloatingPointType;
};
template<> struct MathTypeTraits<std::int16_t>: Implementation::MathTypeTraitsIntegral<std::int16_t> {
typedef std::int32_t NumericType;
typedef float FloatingPointType;
};
template<> struct MathTypeTraits<std::uint32_t>: Implementation::MathTypeTraitsIntegral<std::uint32_t> {
typedef std::uint32_t NumericType;
typedef double FloatingPointType;
};
template<> struct MathTypeTraits<std::int32_t>: Implementation::MathTypeTraitsIntegral<std::int32_t> {
typedef std::int32_t NumericType;
typedef double FloatingPointType;
};
template<> struct MathTypeTraits<std::uint64_t>: Implementation::MathTypeTraitsIntegral<std::uint64_t> {
typedef std::uint64_t NumericType;
typedef long double FloatingPointType;
};
template<> struct MathTypeTraits<std::int64_t>: Implementation::MathTypeTraitsIntegral<std::int64_t> {
typedef std::int64_t NumericType;
typedef long double FloatingPointType;
};
template<> struct MathTypeTraits<float>: Implementation::MathTypeTraitsFloatingPoint<float> {
typedef float NumericType;
typedef float FloatingPointType;
inline constexpr static float epsilon() { return FLOAT_EQUALITY_PRECISION; }
};
template<> struct MathTypeTraits<double>: Implementation::MathTypeTraitsFloatingPoint<double> {
typedef float NumericType;
typedef double FloatingPointType;
inline constexpr static double epsilon() { return DOUBLE_EQUALITY_PRECISION; }

2
src/Math/RectangularMatrix.h

@ -424,7 +424,7 @@ template<std::size_t cols, std::size_t rows, class T> Corrade::Utility::Debug op
if(row != 0) debug << ",\n ";
for(std::size_t col = 0; col != cols; ++col) {
if(col != 0) debug << ", ";
debug << typename MathTypeTraits<T>::NumericType(value[col][row]);
debug << value[col][row];
}
}
debug << ")";

2
src/Math/Vector.h

@ -324,7 +324,7 @@ template<std::size_t size, class T> Corrade::Utility::Debug operator<<(Corrade::
debug.setFlag(Corrade::Utility::Debug::SpaceAfterEachValue, false);
for(std::size_t i = 0; i != size; ++i) {
if(i != 0) debug << ", ";
debug << typename MathTypeTraits<T>::NumericType(value[i]);
debug << value[i];
}
debug << ")";
debug.setFlag(Corrade::Utility::Debug::SpaceAfterEachValue, true);

Loading…
Cancel
Save