[libcxx-commits] [libcxx] [libc++] Optimize __hash_table::erase(iterator, iterator) (PR #152471)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 7 02:49:05 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions  -- libcxx/include/__hash_table
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table
index 2f0f9457f..872fbd480 100644
--- a/libcxx/include/__hash_table
+++ b/libcxx/include/__hash_table
@@ -1854,7 +1854,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __first, const_it
   // current node
   __next_pointer __current = __first.__node_;
   size_type __bucket_count = bucket_count();
-  size_t __chash = std::__constrain_hash(__current->__hash(), __bucket_count);
+  size_t __chash           = std::__constrain_hash(__current->__hash(), __bucket_count);
   // find previous node
   __next_pointer __before_first = __bucket_list_[__chash];
   for (; __before_first->__next_ != __current; __before_first = __before_first->__next_)

``````````

</details>


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


More information about the libcxx-commits mailing list