diff --git a/include/fmt/core.h b/include/fmt/core.h index 3a55f025..b1bf7b9c 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -217,11 +217,17 @@ typename std::add_rvalue_reference::type declval() FMT_NOEXCEPT; template struct result_of; -template struct result_of { - // A workaround for gcc 4.4 that doesn't allow F to be a reference. - typedef typename std::result_of::type( - Args...)>::type type; -}; +#if (__cplusplus >= 201703L || \ + (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)) && \ + __cpp_lib_is_invocable >= 201703L +template +struct result_of : std::invoke_result {}; +#else +// A workaround for gcc 4.4 that doesn't allow F to be a reference. +template +struct result_of + : std::result_of::type(Args...)> {}; +#endif // Casts nonnegative integer to unsigned. template