[llvm] [ADT] Use a C++17 fold expression in BitVector.h (NFC) (PR #161626)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 1 22:05:58 PDT 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/161626
This patch simplifies the assertion by replacing the std::all_of check
with a more direct C++17 fold expression.
>From 3069ca74eed725b2a8f49a28ef7fab02db2b776e Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Wed, 1 Oct 2025 07:42:13 -0700
Subject: [PATCH] [ADT] Use a C++17 fold expression in BitVector.h (NFC)
This patch simplifies the assertion by replacing the std::all_of check
with a more direct C++17 fold expression.
---
llvm/include/llvm/ADT/BitVector.h | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/llvm/include/llvm/ADT/BitVector.h b/llvm/include/llvm/ADT/BitVector.h
index 83350e6e45846..9e81a4b735e7f 100644
--- a/llvm/include/llvm/ADT/BitVector.h
+++ b/llvm/include/llvm/ADT/BitVector.h
@@ -570,10 +570,7 @@ class BitVector {
template <class F, class... ArgTys>
static BitVector &apply(F &&f, BitVector &Out, BitVector const &Arg,
ArgTys const &...Args) {
- assert(llvm::all_of(
- std::initializer_list<unsigned>{Args.size()...},
- [&Arg](auto const &BV) { return Arg.size() == BV; }) &&
- "consistent sizes");
+ assert(((Arg.size() == Args.size()) && ...) && "consistent sizes");
Out.resize(Arg.size());
for (size_type I = 0, E = Arg.Bits.size(); I != E; ++I)
Out.Bits[I] = f(Arg.Bits[I], Args.Bits[I]...);
More information about the llvm-commits
mailing list