diff --git a/Enum.h b/Enum.h index 438ac6d..7c68af4 100644 --- a/Enum.h +++ b/Enum.h @@ -74,12 +74,15 @@ EnumType(_Value value) : _value(value) { } \ template \ explicit EnumType(IntegralType value, \ - typename enable_if::value> \ - ::type *dummy = nullptr) : _value(value) { } \ + typename \ + std::enable_if< \ + std::is_integral::value> \ + ::type *dummy = nullptr) : _value(value) \ + { } \ \ template \ EnumType& operator =(IntegralType value) \ - { *this = EnumType(value); return *this; } \ + { *this = EnumType(value); return *this; } \ \ operator _Value () const { return (_Value)_value; } \ Underlying toUnderlying() const { return (Underlying)_value; } \ diff --git a/EnumInternal.h b/EnumInternal.h index a1a6816..3306b21 100644 --- a/EnumInternal.h +++ b/EnumInternal.h @@ -44,6 +44,8 @@ #include // For size_t. #include // For string and memory routines. +#include + #include "EnumPreprocessorMap.h" @@ -1106,6 +1108,7 @@ class _Internal : public _GeneratedArrays { // failure. if (result == _processedNames[_badIndex]) { // TODO Throw an exception here. + return result; } else return result; @@ -1127,8 +1130,10 @@ class _Internal : public _GeneratedArrays { { EnumType result = find(name); - if (result == (_Value)_values[_badIndex]) + if (result == (_Value)_values[_badIndex]) { // TODO Throw an exception here. + return result; + } else return result; } @@ -1151,6 +1156,7 @@ class _Internal : public _GeneratedArrays { if (result == (_Value)_values[_badIndex]) { // TODO Throw an exception here. + return result; } else return result; @@ -1165,10 +1171,10 @@ class _Internal : public _GeneratedArrays { template static bool valid(IntegralType value) { - static_assert(is_integral::value, + static_assert(std::is_integral::value, "argument to EnumType::valid must have integral type"); - static_assert(is_signed::value == - is_signed::value, + static_assert(std::is_signed::value == + std::is_signed::value, "argument to EnumType::valid must be signed if and only " "if underlying type of EnumType is signed");