提交 bb9d87ad 编写于 作者: N Niels Lohmann 提交者: GitHub

Merge pull request #324 from vpetrigo/has_mapped_improve

make has_mapped_type struct friendly
......@@ -113,10 +113,13 @@ template<typename T>
struct has_mapped_type
{
private:
template<typename C> static char test(typename C::mapped_type*);
template<typename C> static char (&test(...))[2];
template <typename U, typename = typename U::mapped_type>
static int detect(U&&);
static void detect(...);
public:
static constexpr bool value = sizeof(test<T>(0)) == 1;
static constexpr bool value =
std::is_integral<decltype(detect(std::declval<T>()))>::value;
};
/*!
......
......@@ -113,10 +113,13 @@ template<typename T>
struct has_mapped_type
{
private:
template<typename C> static char test(typename C::mapped_type*);
template<typename C> static char (&test(...))[2];
template <typename U, typename = typename U::mapped_type>
static int detect(U&&);
static void detect(...);
public:
static constexpr bool value = sizeof(test<T>(0)) == 1;
static constexpr bool value =
std::is_integral<decltype(detect(std::declval<T>()))>::value;
};
/*!
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册