#ifndef TOML11_TRAITS #define TOML11_TRAITS #include namespace toml { namespace detail { template using unwrap_t = typename std::decay::type; struct has_iterator_impl { template static std::true_type check(typename T::iterator*); template static std::false_type check(...); }; struct has_value_type_impl { template static std::true_type check(typename T::value_type*); template static std::false_type check(...); }; struct has_key_type_impl { template static std::true_type check(typename T::key_type*); template static std::false_type check(...); }; struct has_mapped_type_impl { template static std::true_type check(typename T::mapped_type*); template static std::false_type check(...); }; struct has_resize_method_impl { constexpr static std::size_t dummy=0; template static std::true_type check(decltype(std::declval().resize(dummy))*); template static std::false_type check(...); }; /// Intel C++ compiler can not use decltype in parent class declaration, here /// is a hack to work around it. https://stackoverflow.com/a/23953090/4692076 #ifdef __INTEL_COMPILER #define decltype(...) std::enable_if::type #endif template struct has_iterator : decltype(has_iterator_impl::check(nullptr)){}; template struct has_value_type : decltype(has_value_type_impl::check(nullptr)){}; template struct has_key_type : decltype(has_key_type_impl::check(nullptr)){}; template struct has_mapped_type : decltype(has_mapped_type_impl::check(nullptr)){}; template struct has_resize_method : decltype(has_resize_method_impl::check(nullptr)){}; #ifdef __INTEL_COMPILER #undef decltype(...) #endif }// detail }//toml #endif // TOML_TRAITS