[libcxx-commits] [libcxx] [libc++] Simplify std::equal a bit (PR #171585)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Dec 10 01:48:38 PST 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 origin/main HEAD --extensions ,h -- libcxx/include/__algorithm/equal.h libcxx/include/__algorithm/ranges_equal.h libcxx/include/__bit_reference --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/libcxx/include/__algorithm/ranges_equal.h b/libcxx/include/__algorithm/ranges_equal.h
index 300ff13fa..5b6dfb212 100644
--- a/libcxx/include/__algorithm/ranges_equal.h
+++ b/libcxx/include/__algorithm/ranges_equal.h
@@ -34,8 +34,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 namespace ranges {
 struct __equal {
-
-
   template <input_iterator _Iter1,
             sentinel_for<_Iter1> _Sent1,
             input_iterator _Iter2,
@@ -52,8 +50,8 @@ struct __equal {
       _Pred __pred   = {},
       _Proj1 __proj1 = {},
       _Proj2 __proj2 = {}) const {
-    auto [__ufirst1, __ulast1] = std::__unwrap_range(std::move(__first1), std::move(__last1));
-    auto [__ufirst2, __ulast2] = std::__unwrap_range(std::move(__first2), std::move(__last2));
+    auto [__ufirst1, __ulast1]         = std::__unwrap_range(std::move(__first1), std::move(__last1));
+    auto [__ufirst2, __ulast2]         = std::__unwrap_range(std::move(__first2), std::move(__last2));
     static constexpr bool __both_sized = sized_sentinel_for<_Sent1, _Iter1> && sized_sentinel_for<_Sent2, _Iter2>;
     if constexpr (__both_sized) {
       if (__ulast1 - __ufirst1 != __ulast2 - __ufirst2)

``````````

</details>


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


More information about the libcxx-commits mailing list