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.
This commit is contained in:
higher-performance
2025-04-24 20:30:28 +02:00
committed by GitHub
parent f427890a1d
commit 5f9164978b

View File

@@ -1411,8 +1411,9 @@ void __tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _
__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>