8 #ifndef _SIG_UTIL_TYPE_TRAITS_HPP
9 #define _SIG_UTIL_TYPE_TRAITS_HPP
11 #include "../sigutil.hpp"
13 #include <type_traits>
20 #define CREATE_MEMBER_DETECTOR(X) \
21 template<typename T> class Detect_##X { \
22 struct Fallback { int X; }; \
23 struct Derived : T, Fallback { }; \
25 template<typename U, U> struct Check; \
27 typedef char ArrayOfOne[1]; \
28 typedef char ArrayOfTwo[2]; \
30 template<typename U> static ArrayOfOne & func(Check<int Fallback::*, &U::X> *); \
31 template<typename U> static ArrayOfTwo & func(...); \
33 typedef Detect_##X type; \
34 enum { value = sizeof(func<Derived>(0)) == 2 }; \
40 static const bool value = std::is_const<typename std::remove_reference<T>::type>
::value;
56 #if (SIG_MSVC_ENV && !(SIG_MSVC_VER < 120)) || (SIG_GCC_ENV) || (SIG_CLANG_ENV)
58 struct has_random_access_iter
60 template<
class D,
bool b>
struct Sel{
using type = void; };
61 template<
class D>
struct Sel<D, true>{
using type =
typename std::iterator_traits<typename D::iterator>::iterator_category; };
65 static const bool v = std::is_same<D, std::random_access_iterator_tag>::value;
68 static const bool value = impl_<typename Sel<C, has_iterator<C>::value>::type>::v;
#define CREATE_MEMBER_DETECTOR(X)