[libcxx-commits] [libcxx] [libc++] Improve the performance of std::make_heap a bit (PR #154092)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Aug 18 04:03:50 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 h -- libcxx/include/__algorithm/make_heap.h libcxx/include/__algorithm/partial_sort.h libcxx/include/__algorithm/partial_sort_copy.h libcxx/include/__algorithm/sift_down.h
``````````

</details>

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

``````````diff
diff --git a/libcxx/include/__algorithm/make_heap.h b/libcxx/include/__algorithm/make_heap.h
index 7eb5d6b89..e03092bf6 100644
--- a/libcxx/include/__algorithm/make_heap.h
+++ b/libcxx/include/__algorithm/make_heap.h
@@ -32,8 +32,8 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
 __make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare&& __comp) {
   __comp_ref_type<_Compare> __comp_ref = __comp;
 
-  using __diff_t = __iter_diff_t<_RandomAccessIterator>;
-  const __diff_t __n   = __last - __first;
+  using __diff_t     = __iter_diff_t<_RandomAccessIterator>;
+  const __diff_t __n = __last - __first;
 
   const __diff_t __odd_n = (__n & 1) ? __n : __n - 1;
 

``````````

</details>


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


More information about the libcxx-commits mailing list