Optimize std::__tree::__assign_multi to insert the provided range at the end of the tree every time (#131030)
This improves performance for the copy-assignment operators of associative containers such as `std::map`.
This optimization already exists in other places in the codebase, and seems to have been missed here.
GitOrigin-RevId: 5f9164978b218fa65c53a59e91ea01831735f7a4
diff --git a/include/__tree b/include/__tree
index 247a5ac..bbf7c71 100644
--- a/include/__tree
+++ b/include/__tree
@@ -1411,8 +1411,9 @@
__cache.__advance();
}
}
+ const_iterator __e = end();
for (; __first != __last; ++__first)
- __insert_multi(_NodeTypes::__get_value(*__first));
+ __insert_multi(__e, _NodeTypes::__get_value(*__first));
}
template <class _Tp, class _Compare, class _Allocator>