[llvm] [STLExtras] Introduce bind_{first, last}, [not_]equal_to (PR #175056)
Jakub Kuderski via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 8 14:21:52 PST 2026
================
@@ -32,17 +32,11 @@ template <typename Pattern> bool match(VPSingleDefRecipe *R, const Pattern &P) {
return P.match(static_cast<const VPRecipeBase *>(R));
}
-template <typename Val, typename Pattern> struct VPMatchFunctor {
- const Pattern &P;
- VPMatchFunctor(const Pattern &P) : P(P) {}
- bool operator()(Val *V) const { return match(V, P); }
-};
-
/// A match functor that can be used as a UnaryPredicate in functional
/// algorithms like all_of.
-template <typename Val = VPUser, typename Pattern>
-VPMatchFunctor<Val, Pattern> match_fn(const Pattern &P) {
- return P;
+template <typename Val = VPUser *, typename Pattern>
+auto match_fn(const Pattern &P) {
+ return bind_last<Pattern, decltype(match<Val, Pattern>)>(P, match);
----------------
kuhar wrote:
You shouldn't have to provide the template arguments here
https://github.com/llvm/llvm-project/pull/175056
More information about the llvm-commits
mailing list