From e9fde3e1166abb6ede4881c832c22d750e69e77b Mon Sep 17 00:00:00 2001 From: Vladimir Petrigo Date: Sat, 8 Oct 2016 01:03:35 +0300 Subject: [PATCH] make has_mapped_type struct friendly --- src/json.hpp | 9 ++++++--- src/json.hpp.re2c | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/json.hpp b/src/json.hpp index 04c8573f..57fecf99 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 48224835..e26ac7c7 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; }; /*!