[llvm] [ADT] Refactor Bitset to Be More Constexpr-Usable and Add More Member Functions (PR #172062)
Jakub Kuderski via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 16 10:51:51 PST 2025
================
@@ -1734,22 +1734,31 @@ UnaryFunction for_each(R &&Range, UnaryFunction F) {
/// Provide wrappers to std::all_of which take ranges instead of having to pass
/// begin/end explicitly.
template <typename R, typename UnaryPredicate>
-bool all_of(R &&Range, UnaryPredicate P) {
- return std::all_of(adl_begin(Range), adl_end(Range), P);
+constexpr bool all_of(R &&Range, UnaryPredicate P) {
+ for (auto &&Element : Range)
+ if (!P(std::forward<decltype(Element)>(Element)))
+ return false;
+ return true;
----------------
kuhar wrote:
I think we may want to base the implementation off a custom `find_if`.
https://github.com/llvm/llvm-project/pull/172062
More information about the llvm-commits
mailing list