[libcxx-commits] [libcxx] 562c0b0 - [libc++] Use the fast path for move assignment in __tree if the allocator is_always_equal (#177115)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jan 28 07:52:23 PST 2026


Author: Nikolas Klauser
Date: 2026-01-28T10:52:18-05:00
New Revision: 562c0b002c155098cf95e08b6f3e85b656f5eee9

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

LOG: [libc++] Use the fast path for move assignment in __tree if the allocator is_always_equal (#177115)

This avoids instantiating some code that we know is dead. This is also a
prerequisite for #134330, since we avoid trying to `const_cast` in the
common case now.

Added: 
    

Modified: 
    libcxx/include/__tree

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__tree b/libcxx/include/__tree
index fbb48f8196964..847ea2c0851d4 100644
--- a/libcxx/include/__tree
+++ b/libcxx/include/__tree
@@ -998,7 +998,10 @@ public:
                  ((__node_traits::propagate_on_container_move_assignment::value &&
                    is_nothrow_move_assignable<__node_allocator>::value) ||
                   allocator_traits<__node_allocator>::is_always_equal::value)) {
-    __move_assign(__t, integral_constant<bool, __node_traits::propagate_on_container_move_assignment::value>());
+    __move_assign(__t,
+                  integral_constant<bool,
+                                    __node_traits::propagate_on_container_move_assignment::value ||
+                                        __node_traits::is_always_equal::value>());
     return *this;
   }
 


        


More information about the libcxx-commits mailing list