[llvm-branch-commits] [flang] [flang][OpenMP] Use new modifier code in ORDER and SCHEDULE clauses (PR #117081)

Tom Eccles via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Nov 21 09:17:18 PST 2024


================
@@ -153,6 +153,16 @@ std::optional<ResultTy> maybeApply(FuncTy &&func,
   return std::move(func(*arg));
 }
 
+template <
+    typename FuncTy, //
+    typename ArgTy,  //
+    typename ResultTy = std::invoke_result_t<FuncTy, typename ArgTy::Value>>
+std::optional<ResultTy> maybeApplyToV(FuncTy &&func, const ArgTy *arg) {
+  if (!arg)
+    return std::nullopt;
+  return std::move(func(arg->v));
----------------
tblah wrote:

nit: I don't think this `std::move` is necessary. In the uses I can see here `ResultTy` is not a reference. Therefore, the function result is a prvalue and so will be moved automatically.

https://github.com/llvm/llvm-project/pull/117081


More information about the llvm-branch-commits mailing list