diff --git a/src/json.hpp b/src/json.hpp index 04c8573f430fe425a7838b18be6a7c95a5fd316f..57fecf991e551cf54b19b29c6c0385ed78e1ceb5 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -112,10 +112,13 @@ template struct has_mapped_type { private: - template static char test(typename C::mapped_type*); - template static char (&test(...))[2]; + template + static int detect(U&&); + + static void detect(...); public: - static constexpr bool value = sizeof(test(0)) == 1; + static constexpr bool value = + std::is_integral()))>::value; }; /*! diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index 48224835423fa129871366c8646bde232737eb2b..e26ac7c7b7fa3552fc9543cb00159a5db64ca82c 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -112,10 +112,13 @@ template struct has_mapped_type { private: - template static char test(typename C::mapped_type*); - template static char (&test(...))[2]; + template + static int detect(U&&); + + static void detect(...); public: - static constexpr bool value = sizeof(test(0)) == 1; + static constexpr bool value = + std::is_integral()))>::value; }; /*!