Commit bb9d87ad authored by Niels Lohmann's avatar Niels Lohmann Committed by GitHub

Merge pull request #324 from vpetrigo/has_mapped_improve

make has_mapped_type struct friendly
parents e7a60d89 e9fde3e1
......@@ -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%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment