[libcxx-commits] [libcxx] [libc++] Refactor remaining __find_equal calls (PR #156594)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Sep 2 23:40:50 PDT 2025
https://github.com/philnik777 created https://github.com/llvm/llvm-project/pull/156594
#147345 refactored `__find_equal`. Unfortunately there was a merge conflict with another patch. This fixes up the problematic places.
>From 610ad706a09c55792c3f63b0643a0508590a0e8f Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Wed, 3 Sep 2025 08:39:22 +0200
Subject: [PATCH] [libc++] Refactor remaining __find_equal calls
---
libcxx/include/__tree | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
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