Fix in HasEnum that was always returning true.
This commit is contained in:
parent
987cdd66ef
commit
5e6c537a2d
1 changed files with 3 additions and 2 deletions
|
@ -45,10 +45,11 @@
|
||||||
private: \
|
private: \
|
||||||
struct TrueType { int a[2]; }; \
|
struct TrueType { int a[2]; }; \
|
||||||
typedef int FalseType; \
|
typedef int FalseType; \
|
||||||
template <typename C> static TrueType has_enum ( int = C::enum_name ); \
|
template <int> void f ( void ); \
|
||||||
|
template <typename C> static TrueType has_enum ( decltype(&f<C::enum_name>) = nullptr ); \
|
||||||
template <typename C> static FalseType has_enum ( ... ); \
|
template <typename C> static FalseType has_enum ( ... ); \
|
||||||
public:\
|
public:\
|
||||||
enum { value = sizeof(has_enum<T>(0)) == sizeof(TrueType) }; \
|
enum { value = sizeof(has_enum<T>(nullptr)) == sizeof(TrueType) }; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue