From ddc9f4c61df438952a4c0c2e451d25677ecf4b2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Thu, 21 May 2020 21:39:19 +0200 Subject: [PATCH] Avoid using std::result_of when std::invoke_result is available Closes #1934 --- .../internal/benchmark/detail/catch_complete_invoke.hpp | 9 ++++----- include/internal/benchmark/detail/catch_timing.hpp | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/internal/benchmark/detail/catch_complete_invoke.hpp b/include/internal/benchmark/detail/catch_complete_invoke.hpp index abeb2ac7..b87e95db 100644 --- a/include/internal/benchmark/detail/catch_complete_invoke.hpp +++ b/include/internal/benchmark/detail/catch_complete_invoke.hpp @@ -12,6 +12,7 @@ #define TWOBLUECUBES_CATCH_DETAIL_COMPLETE_INVOKE_HPP_INCLUDED #include "../../catch_enforce.h" +#include "../../catch_meta.hpp" #include #include @@ -42,20 +43,18 @@ namespace Catch { return {}; } }; - template - using ResultOf_t = typename std::result_of::type; // invoke and not return void :( template - CompleteType_t> complete_invoke(Fun&& fun, Args&&... args) { - return CompleteInvoker>::invoke(std::forward(fun), std::forward(args)...); + CompleteType_t> complete_invoke(Fun&& fun, Args&&... args) { + return CompleteInvoker>::invoke(std::forward(fun), std::forward(args)...); } const std::string benchmarkErrorMsg = "a benchmark failed to run successfully"; } // namespace Detail template - Detail::CompleteType_t> user_code(Fun&& fun) { + Detail::CompleteType_t> user_code(Fun&& fun) { CATCH_TRY{ return Detail::complete_invoke(std::forward(fun)); } CATCH_CATCH_ALL{ diff --git a/include/internal/benchmark/detail/catch_timing.hpp b/include/internal/benchmark/detail/catch_timing.hpp index 073cb742..d4141d2b 100644 --- a/include/internal/benchmark/detail/catch_timing.hpp +++ b/include/internal/benchmark/detail/catch_timing.hpp @@ -26,7 +26,7 @@ namespace Catch { int iterations; }; template - using TimingOf = Timing, Detail::CompleteType_t>>; + using TimingOf = Timing, Detail::CompleteType_t>>; } // namespace Benchmark } // namespace Catch