[llvm] [STLExtras] Introduce BinaryPredicateFunctor, [not_]equal_to (PR #175056)

Jakub Kuderski via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 8 12:17:16 PST 2026


================
@@ -2157,6 +2157,30 @@ template <typename T> bool all_equal(std::initializer_list<T> Values) {
   return all_equal<std::initializer_list<T>>(std::move(Values));
 }
 
+template <typename ValT, typename RefT, typename BinaryPredicate>
+struct BinaryPredicateFunctor {
----------------
kuhar wrote:

I think you could implement this as a function that returns a lambda that binds the first arg:

```c++
template <typename RefT, typename BinaryPredT>
auto bind_lhs(const Ref& Ref, BinaryPredT Pred) {
  return [&Ref] (const auto& Val) { return Pred(Ref, Val); }
}
```

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


More information about the llvm-commits mailing list