提交 e9fde3e1 编写于 作者: V Vladimir Petrigo

make has_mapped_type struct friendly

上级 a0ef5a19
...@@ -112,10 +112,13 @@ template<typename T> ...@@ -112,10 +112,13 @@ template<typename T>
struct has_mapped_type struct has_mapped_type
{ {
private: private:
template<typename C> static char test(typename C::mapped_type*); template <typename U, typename = typename U::mapped_type>
template<typename C> static char (&test(...))[2]; static int detect(U&&);
static void detect(...);
public: public:
static constexpr bool value = sizeof(test<T>(0)) == 1; static constexpr bool value =
std::is_integral<decltype(detect(std::declval<T>()))>::value;
}; };
/*! /*!
......
...@@ -112,10 +112,13 @@ template<typename T> ...@@ -112,10 +112,13 @@ template<typename T>
struct has_mapped_type struct has_mapped_type
{ {
private: private:
template<typename C> static char test(typename C::mapped_type*); template <typename U, typename = typename U::mapped_type>
template<typename C> static char (&test(...))[2]; static int detect(U&&);
static void detect(...);
public: 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.
先完成此消息的编辑!
想要评论请 注册