diff --git a/single_include/toml.hpp b/single_include/toml.hpp index a8894f1..75fcf6b 100644 --- a/single_include/toml.hpp +++ b/single_include/toml.hpp @@ -1844,6 +1844,35 @@ using return_type_of_t = typename std::result_of::type; } // cxx } // toml +// --------------------------------------------------------------------------- +// C++17 void_t + +#if TOML11_CPLUSPLUS_STANDARD_VERSION >= TOML11_CXX17_VALUE +# if defined(__cpp_lib_void_t) +# if __cpp_lib_void_t >= 201411L +# define TOML11_HAS_STD_VOID_T 1 +# endif +# endif +#endif + +namespace toml +{ +namespace cxx +{ +#if defined(TOML11_HAS_STD_VOID_T) + +using std::void_t; + +#else + +template +using void_t = void; + +#endif // TOML11_HAS_STD_VOID_T + +} // cxx +} // toml + // ---------------------------------------------------------------------------- // (subset of) source_location @@ -8342,77 +8371,53 @@ namespace detail // ---------------------------------------------------------------------------- // check if type T has all the needed member types -struct has_comment_type_impl -{ - template static std::true_type check(typename T::comment_type*); - template static std::false_type check(...); -}; +template +struct has_comment_type: std::false_type{}; template -using has_comment_type = decltype(has_comment_type_impl::check(nullptr)); +struct has_comment_type>: std::true_type{}; -struct has_integer_type_impl -{ - template static std::true_type check(typename T::integer_type*); - template static std::false_type check(...); -}; +template +struct has_integer_type: std::false_type{}; template -using has_integer_type = decltype(has_integer_type_impl::check(nullptr)); +struct has_integer_type>: std::true_type{}; -struct has_floating_type_impl -{ - template static std::true_type check(typename T::floating_type*); - template static std::false_type check(...); -}; +template +struct has_floating_type: std::false_type{}; template -using has_floating_type = decltype(has_floating_type_impl::check(nullptr)); +struct has_floating_type>: std::true_type{}; -struct has_string_type_impl -{ - template static std::true_type check(typename T::string_type*); - template static std::false_type check(...); -}; +template +struct has_string_type: std::false_type{}; template -using has_string_type = decltype(has_string_type_impl::check(nullptr)); +struct has_string_type>: std::true_type{}; -struct has_array_type_impl -{ - template static std::true_type check(typename T::template array_type*); - template static std::false_type check(...); -}; +template +struct has_array_type: std::false_type{}; template -using has_array_type = decltype(has_array_type_impl::check(nullptr)); +struct has_array_type>>: std::true_type{}; -struct has_table_type_impl -{ - template static std::true_type check(typename T::template table_type*); - template static std::false_type check(...); -}; +template +struct has_table_type: std::false_type{}; template -using has_table_type = decltype(has_table_type_impl::check(nullptr)); +struct has_table_type>>: std::true_type{}; -struct has_parse_int_impl -{ - template static std::true_type check(decltype(std::declval().parse_int( - std::declval(), - std::declval(), - std::declval() - ))*); - template static std::false_type check(...); -}; +template +struct has_parse_int: std::false_type{}; template -using has_parse_int = decltype(has_parse_int_impl::check(nullptr)); +struct has_parse_int().parse_int( + std::declval(), + std::declval<::toml::source_location const&>(), + std::declval() + ))>>: std::true_type{}; -struct has_parse_float_impl -{ - template static std::true_type check(decltype(std::declval().parse_float( - std::declval(), - std::declval(), - std::declval() - ))*); - template static std::false_type check(...); -}; +template +struct has_parse_float: std::false_type{}; template -using has_parse_float = decltype(has_parse_float_impl::check(nullptr)); +struct has_parse_float().parse_float( + std::declval(), + std::declval<::toml::source_location const&>(), + std::declval() + ))>>: std::true_type{}; template using is_type_config = cxx::conjunction<