[muparser] Remove struct TypeInfo

The STL's facilities are totally sufficient here.
This commit is contained in:
ridiculousfish 2017-12-18 10:56:07 -08:00
parent 364f58fcfa
commit f0de6e0852
3 changed files with 3 additions and 55 deletions

View file

@ -4,59 +4,6 @@
#include <cmath>
namespace mu {
//-----------------------------------------------------------------------------------------------
//
// Compile time type detection
//
//-----------------------------------------------------------------------------------------------
/** \brief A class singling out integer types at compile time using
template meta programming.
*/
template <typename T>
struct TypeInfo {
static bool IsInteger() { return false; }
};
template <>
struct TypeInfo<char> {
static bool IsInteger() { return true; }
};
template <>
struct TypeInfo<short> {
static bool IsInteger() { return true; }
};
template <>
struct TypeInfo<int> {
static bool IsInteger() { return true; }
};
template <>
struct TypeInfo<long> {
static bool IsInteger() { return true; }
};
template <>
struct TypeInfo<unsigned char> {
static bool IsInteger() { return true; }
};
template <>
struct TypeInfo<unsigned short> {
static bool IsInteger() { return true; }
};
template <>
struct TypeInfo<unsigned int> {
static bool IsInteger() { return true; }
};
template <>
struct TypeInfo<unsigned long> {
static bool IsInteger() { return true; }
};
//-----------------------------------------------------------------------------------------------
//

View file

@ -158,7 +158,7 @@ ValueOrError SelfTest() {
mu::console() << _T( "Running test suite:\n\n");
// Skip the self test if the value type is set to an integer type.
if (mu::TypeInfo<mu::value_type>::IsInteger()) {
if (std::numeric_limits<mu::value_type>::is_integer) {
mu::console()
<< _T( " Test skipped: integer data type are not compatible with the unit test!\n\n");
} else {

View file

@ -29,6 +29,7 @@
//--- Standard includes ------------------------------------------------------------------------
#include <algorithm>
#include <cmath>
#include <limits>
#include <numeric>
/** \brief Pi (what else?). */
@ -237,7 +238,7 @@ static void assertNoError(OptionalError oerr) {
//---------------------------------------------------------------------------
/** \brief Initialize the default functions. */
void Parser::InitFun() {
if (mu::TypeInfo<mu::value_type>::IsInteger()) {
if (std::numeric_limits<mu::value_type>::is_integer) {
// When setting MUP_BASETYPE to an integer type
// Place functions for dealing with integer values here
// ...