Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Avoid using std::result_of when std::invoke_result is available

Closes #1934
Commit
ddc9f4c61df438952a4c0c2e451d25677ecf4b2b
Author
Martin Hořeňovský ·
Parents
bed47374cee0

Files · Download .tar.gz

Changes

 include/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 <type_traits>
 #include <utility>
@@ -42,20 +43,18 @@ namespace Catch {
                     return {};
                 }
             };
-            template <typename Sig>
-            using ResultOf_t = typename std::result_of<Sig>::type;
 
             // invoke and not return void :(
             template <typename Fun, typename... Args>
-            CompleteType_t<ResultOf_t<Fun(Args...)>> complete_invoke(Fun&& fun, Args&&... args) {
-                return CompleteInvoker<ResultOf_t<Fun(Args...)>>::invoke(std::forward<Fun>(fun), std::forward<Args>(args)...);
+            CompleteType_t<FunctionReturnType<Fun(Args...)>> complete_invoke(Fun&& fun, Args&&... args) {
+                return CompleteInvoker<FunctionReturnType<Fun(Args...)>>::invoke(std::forward<Fun>(fun), std::forward<Args>(args)...);
             }
 
             const std::string benchmarkErrorMsg = "a benchmark failed to run successfully";
         } // namespace Detail
 
         template <typename Fun>
-        Detail::CompleteType_t<Detail::ResultOf_t<Fun()>> user_code(Fun&& fun) {
+        Detail::CompleteType_t<FunctionReturnType<Fun()>> user_code(Fun&& fun) {
             CATCH_TRY{
                 return Detail::complete_invoke(std::forward<Fun>(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 <typename Clock, typename Sig>
-        using TimingOf = Timing<ClockDuration<Clock>, Detail::CompleteType_t<Detail::ResultOf_t<Sig>>>;
+        using TimingOf = Timing<ClockDuration<Clock>, Detail::CompleteType_t<FunctionReturnType<Sig>>>;
     } // namespace Benchmark
 } // namespace Catch