Skip to content

Commit 4f12629

Browse files
Optimize std::__tree::__assign_multi to insert the provided range at the end of the tree every time
This improves performance for the copy-assignment operators of associative containers such as std::map
1 parent c017cdf commit 4f12629

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

libcxx/include/__tree

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1432,8 +1432,9 @@ void __tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _
14321432
__cache.__advance();
14331433
}
14341434
}
1435+
const_iterator __e = end();
14351436
for (; __first != __last; ++__first)
1436-
__insert_multi(_NodeTypes::__get_value(*__first));
1437+
__insert_multi(__e, _NodeTypes::__get_value(*__first));
14371438
}
14381439

14391440
template <class _Tp, class _Compare, class _Allocator>

0 commit comments

Comments
 (0)