]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: use maintained size when split pb_ds binary search trees
authorXℹ Ruoyao <xry111@mengyan1223.wang>
Fri, 10 Jul 2020 13:38:09 +0000 (21:38 +0800)
committerXi Ruoyao <xry111@xry111.site>
Wed, 21 May 2025 07:10:22 +0000 (15:10 +0800)
libstdc++-v3/ChangeLog:

PR libstdc++/81806
* include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp
(split_finish): Use maintained size, instead of calling
std::distance.

libstdc++-v3/include/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp

index 0c1b26fa9e2df7b8f530e4203301ec44b71442b2..a2a57757a046734ab9f807aa3abc436af0a31878 100644 (file)
@@ -133,7 +133,9 @@ PB_DS_CLASS_C_DEC::
 split_finish(PB_DS_CLASS_C_DEC& other)
 {
   other.initialize_min_max();
-  other.m_size = std::distance(other.begin(), other.end());
+  other.m_size = 0;
+  if (other.m_p_head->m_p_parent != 0)
+    other.m_size = other.m_p_head->m_p_parent->m_subtree_size;
   m_size -= other.m_size;
   initialize_min_max();
   PB_DS_ASSERT_VALID((*this))