[llvm] adb0cd6 - [Support] TaskQueue.h - replace std::result_of_t with std::invoke_result_t

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 9 02:53:28 PDT 2022


Author: Simon Pilgrim
Date: 2022-08-09T10:52:39+01:00
New Revision: adb0cd62a98cca26c740364bca308d089bb07cc1

URL: https://github.com/llvm/llvm-project/commit/adb0cd62a98cca26c740364bca308d089bb07cc1
DIFF: https://github.com/llvm/llvm-project/commit/adb0cd62a98cca26c740364bca308d089bb07cc1.diff

LOG: [Support] TaskQueue.h - replace std::result_of_t with std::invoke_result_t

std::result_of_t is deprecated in C++17

Fixes #57023

Added: 
    

Modified: 
    llvm/include/llvm/Support/TaskQueue.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/TaskQueue.h b/llvm/include/llvm/Support/TaskQueue.h
index d89ce2b42d21..1b44a163568a 100644
--- a/llvm/include/llvm/Support/TaskQueue.h
+++ b/llvm/include/llvm/Support/TaskQueue.h
@@ -38,7 +38,7 @@ class TaskQueue {
   // type-specialized domain (before type erasure) and then erase this into a
   // std::function.
   template <typename Callable> struct Task {
-    using ResultTy = std::result_of_t<Callable()>;
+    using ResultTy = std::invoke_result_t<Callable>;
     explicit Task(Callable C, TaskQueue &Parent)
         : C(std::move(C)), P(std::make_shared<std::promise<ResultTy>>()),
           Parent(&Parent) {}
@@ -78,13 +78,13 @@ class TaskQueue {
   /// used to wait for the task (and all previous tasks that have not yet
   /// completed) to finish.
   template <typename Callable>
-  std::future<std::result_of_t<Callable()>> async(Callable &&C) {
+  std::future<std::invoke_result_t<Callable>> async(Callable &&C) {
 #if !LLVM_ENABLE_THREADS
     static_assert(false,
                   "TaskQueue requires building with LLVM_ENABLE_THREADS!");
 #endif
     Task<Callable> T{std::move(C), *this};
-    using ResultTy = std::result_of_t<Callable()>;
+    using ResultTy = std::invoke_result_t<Callable>;
     std::future<ResultTy> F = T.P->get_future();
     {
       std::lock_guard<std::mutex> Lock(QueueLock);


        


More information about the llvm-commits mailing list