From 406e632bd1d956450ae1690d9b5231c0225f91ac Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Fri, 31 May 2019 08:54:32 -0700 Subject: [PATCH] result_of -> invoke_result_t --- include/fmt/core.h | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 5ff02fa4..9e06a2d9 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -215,18 +215,15 @@ using std_string_view = std::experimental::basic_string_view; template struct std_string_view {}; #endif -template struct result_of; - #if (__cplusplus >= 201703L || \ (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)) && \ __cpp_lib_is_invocable >= 201703L template -struct result_of : std::invoke_result {}; +using invoke_result_t = std::invoke_result_t; #else -// A workaround for gcc 4.4 that doesn't allow F to be a reference. +// An implementation of invoke_result for pre-C++17. template -struct result_of - : std::result_of::type(Args...)> {}; +using invoke_result_t = typename std::result_of::type; #endif // Casts nonnegative integer to unsigned. @@ -906,8 +903,8 @@ template class basic_format_arg { const T& value); template - friend FMT_CONSTEXPR typename internal::result_of::type - visit_format_arg(Visitor&& vis, const basic_format_arg& arg); + friend FMT_CONSTEXPR internal::invoke_result_t visit_format_arg( + Visitor&& vis, const basic_format_arg& arg); friend class basic_format_args; friend class internal::arg_map; @@ -949,7 +946,7 @@ struct monostate {}; \endrst */ template -FMT_CONSTEXPR typename internal::result_of::type visit_format_arg( +FMT_CONSTEXPR internal::invoke_result_t visit_format_arg( Visitor&& vis, const basic_format_arg& arg) { typedef typename Context::char_type char_type; switch (arg.type_) { @@ -988,8 +985,8 @@ FMT_CONSTEXPR typename internal::result_of::type visit_format_arg( } template -FMT_DEPRECATED FMT_CONSTEXPR typename internal::result_of::type -visit(Visitor&& vis, const basic_format_arg& arg) { +FMT_DEPRECATED FMT_CONSTEXPR internal::invoke_result_t visit( + Visitor&& vis, const basic_format_arg& arg) { return visit_format_arg(std::forward(vis), arg); }