[libcxx-commits] [libcxx] f1dcdaa - [libc++] Refactor remaining __find_equal calls (#156594)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Sep 3 00:16:49 PDT 2025


Author: Nikolas Klauser
Date: 2025-09-03T09:16:46+02:00
New Revision: f1dcdaac09b9271e00aeb095735ef984ae69752b

URL: https://github.com/llvm/llvm-project/commit/f1dcdaac09b9271e00aeb095735ef984ae69752b
DIFF: https://github.com/llvm/llvm-project/commit/f1dcdaac09b9271e00aeb095735ef984ae69752b.diff

LOG: [libc++] Refactor remaining __find_equal calls (#156594)

#147345 refactored `__find_equal`. Unfortunately there was a merge
conflict with another patch. This fixes up the problematic places.

Added: 
    

Modified: 
    libcxx/include/__tree

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__tree b/libcxx/include/__tree
index 9010e8b97eede..c5f52f404eff3 100644
--- a/libcxx/include/__tree
+++ b/libcxx/include/__tree
@@ -1046,8 +1046,7 @@ public:
                                static_cast<__node_base_pointer>(__nd.get()));
               __max_node = __nd.release();
             } else {
-              __end_node_pointer __parent;
-              __node_base_pointer& __child = __find_equal(__parent, __key);
+              auto [__parent, __child] = __find_equal(__key);
               if (__child == nullptr) {
                 __node_holder __nd = __construct_node(std::forward<__reference>(__val));
                 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd.release()));
@@ -1062,8 +1061,7 @@ public:
                                static_cast<__node_base_pointer>(__nd.get()));
               __max_node = __nd.release();
             } else {
-              __end_node_pointer __parent;
-              __node_base_pointer& __child = __find_equal(__parent, __nd->__get_value());
+              auto [__parent, __child] = __find_equal(__nd->__get_value());
               if (__child == nullptr) {
                 __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd.release()));
               }


        


More information about the libcxx-commits mailing list