================
@@ -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
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to