From f50195524f112da4d7b38ab92770bd2d4665c303 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Sat, 14 Nov 2020 23:31:30 +0100 Subject: [PATCH] As described in #139, fixed complexity of "merge", as a O(n) inplace merge is used and explicitly state all iterators are invalidated. --- include/boost/container/flat_map.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/boost/container/flat_map.hpp b/include/boost/container/flat_map.hpp index 70d3745..4cf41af 100644 --- a/include/boost/container/flat_map.hpp +++ b/include/boost/container/flat_map.hpp @@ -1215,7 +1215,9 @@ class flat_map //! the comparison object of *this. If there is an element in a with key equivalent to the //! key of an element from source, then that element is not moved from source. //! - //! Complexity: N log(size() + N) (N has the value source.size()) + //! Complexity: Linear in this->size() + source.size(). + //! + //! Note: Invalidates all iterators and references. template BOOST_CONTAINER_FORCEINLINE void merge(flat_map& source) { m_flat_tree.merge_unique(source.tree()); } @@ -2576,7 +2578,9 @@ class flat_multimap //! Effects: Move-inserts each element from source into *this a using //! the comparison object of *this. //! - //! Complexity: N log(size() + N) (N has the value source.size()) + //! Complexity: Linear in this->size() + source.size(). + //! + //! Note: Invalidates all iterators and references. template BOOST_CONTAINER_FORCEINLINE void merge(flat_multimap& source) { m_flat_tree.merge_equal(source.tree()); }